chore: 어드민 수정 심사에서 누락된 발표 자료 필드 추가 #206
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to AWS S3 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}-${{ github.event.inputs.WORKFLOW_PHASE || 'dev' }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
inputs: | |
WORKFLOW_PHASE: | |
description: "Environment to deploy to" | |
required: true | |
default: dev | |
type: choice | |
options: | |
- dev | |
- prod | |
push: | |
branches: | |
- "main" | |
permissions: | |
id-token : write | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
API_STAGE: ${{ github.event_name == 'workflow_dispatch' && inputs.WORKFLOW_PHASE || 'dev' }} | |
BUMP_RULE: ${{ (github.event_name == 'workflow_dispatch' && inputs.WORKFLOW_PHASE || 'dev') == 'dev' && '--mode development' || '' }} | |
AWS_S3_PYCONKR_FRONTEND_BUCKET: ${{ (github.event_name == 'workflow_dispatch' && inputs.WORKFLOW_PHASE || 'dev') == 'dev' && secrets.AWS_S3_PYCONKR_FRONTEND_BUCKET_DEV || secrets.AWS_S3_PYCONKR_FRONTEND_BUCKET_PROD }} | |
AWS_S3_PYCONKR_ADMIN_BUCKET: ${{ (github.event_name == 'workflow_dispatch' && inputs.WORKFLOW_PHASE || 'dev') == 'dev' && secrets.AWS_S3_PYCONKR_ADMIN_BUCKET_DEV || secrets.AWS_S3_PYCONKR_ADMIN_BUCKET_PROD }} | |
AWS_S3_PYCONKR_PARTICIPANT_PORTAL_BUCKET: ${{ (github.event_name == 'workflow_dispatch' && inputs.WORKFLOW_PHASE || 'dev') == 'dev' && secrets.AWS_S3_PYCONKR_PARTICIPANT_PORTAL_BUCKET_DEV || secrets.AWS_S3_PYCONKR_PARTICIPANT_PORTAL_BUCKET_PROD }} | |
AWS_CLOUDFRONT_PYCONKR_FRONTEND_DISTRIBUTION_ID: ${{ (github.event_name == 'workflow_dispatch' && inputs.WORKFLOW_PHASE || 'dev') == 'dev' && secrets.AWS_CLOUDFRONT_PYCONKR_FRONTEND_DISTRIBUTION_ID_DEV || secrets.AWS_CLOUDFRONT_PYCONKR_FRONTEND_DISTRIBUTION_ID_PROD }} | |
AWS_CLOUDFRONT_PYCONKR_ADMIN_DISTRIBUTION_ID: ${{ (github.event_name == 'workflow_dispatch' && inputs.WORKFLOW_PHASE || 'dev') == 'dev' && secrets.AWS_CLOUDFRONT_PYCONKR_ADMIN_DISTRIBUTION_ID_DEV || secrets.AWS_CLOUDFRONT_PYCONKR_ADMIN_DISTRIBUTION_ID_PROD }} | |
AWS_CLOUDFRONT_PYCONKR_PARTICIPANT_PORTAL_DISTRIBUTION_ID: ${{ (github.event_name == 'workflow_dispatch' && inputs.WORKFLOW_PHASE || 'dev') == 'dev' && secrets.AWS_CLOUDFRONT_PYCONKR_PARTICIPANT_PORTAL_DISTRIBUTION_ID_DEV || secrets.AWS_CLOUDFRONT_PYCONKR_PARTICIPANT_PORTAL_DISTRIBUTION_ID_PROD }} | |
strategy: | |
matrix: | |
application: [pyconkr, pyconkr-admin, pyconkr-participant-portal] | |
include: | |
- application: pyconkr | |
aws_s3_bucket_key: AWS_S3_PYCONKR_FRONTEND_BUCKET | |
aws_cloudfront_distribution_key: AWS_CLOUDFRONT_PYCONKR_FRONTEND_DISTRIBUTION_ID | |
- application: pyconkr-admin | |
aws_s3_bucket_key: AWS_S3_PYCONKR_ADMIN_BUCKET | |
aws_cloudfront_distribution_key: AWS_CLOUDFRONT_PYCONKR_ADMIN_DISTRIBUTION_ID | |
- application: pyconkr-participant-portal | |
aws_s3_bucket_key: AWS_S3_PYCONKR_PARTICIPANT_PORTAL_BUCKET | |
aws_cloudfront_distribution_key: AWS_CLOUDFRONT_PYCONKR_PARTICIPANT_PORTAL_DISTRIBUTION_ID | |
steps: | |
- uses: actions/checkout@master | |
- uses: aws-actions/configure-aws-credentials@master | |
with: | |
role-session-name: ${{ github.run_id }} | |
role-to-assume: ${{ secrets.AWS_FRONTEND_DEPLOYMENT_ROLE_ARN }} | |
aws-region: ${{ vars.AWS_REGION }} | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'pnpm' | |
cache-dependency-path: 'pnpm-lock.yaml' | |
- name: Get current repo name | |
id: info | |
run: echo "::set-output name=repository_name::$(echo ${{ github.repository }} | sed -e 's/${{ github.repository_owner }}\///')" | |
- name: Install project dependencies | |
run: pnpm install --frozen-lockfile | |
- run: mkdir -p dist | |
- run: pnpm build:@apps/${{ matrix.application }} ${{ env.BUMP_RULE }} && cp -r apps/${{ matrix.application }}/dist/* dist/ | |
- run: aws s3 cp --recursive ./dist s3://${{ env[matrix.aws_s3_bucket_key] }}/ | |
- run: aws cloudfront create-invalidation --distribution-id ${{ env[matrix.aws_cloudfront_distribution_key] }} --paths "/*" | |
# Notify to Slack (Success) | |
- name: Notify deployment to Slack | |
if: failure() || cancelled() | |
uses: slackapi/[email protected] | |
with: | |
channel-id: ${{ vars.SLACK_DEPLOYMENT_ALERT_CHANNEL }} | |
payload: | | |
{ | |
"blocks": [ | |
{ | |
"type": "header", | |
"text": { | |
"type": "plain_text", | |
"text": "${{ steps.info.outputs.repository_name }} ${{ matrix.application }} (${{ env.API_STAGE }}) 배포 실패 :rotating_light: (${{ job.status }})", | |
"emoji": true | |
} | |
}, | |
{ | |
"type": "section", | |
"text": {"type": "mrkdwn", "text": "GitHub Action 바로가기"}, | |
"accessory": { | |
"type": "button", | |
"text": {"type": "plain_text", "text": "${{ github.run_id }}"}, | |
"value": "github_action", | |
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | |
"action_id": "button-action" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
# Notify to Slack (Failure) | |
- name: Notify deployment to Slack | |
uses: slackapi/[email protected] | |
with: | |
channel-id: ${{ vars.SLACK_DEPLOYMENT_ALERT_CHANNEL }} | |
payload: | | |
{ | |
"blocks": [ | |
{ | |
"type": "header", | |
"text": { | |
"type": "plain_text", | |
"text": "${{ steps.info.outputs.repository_name }} ${{ matrix.application }} (${{ env.API_STAGE }}) 배포 성공 :tada:", | |
"emoji": true | |
} | |
}, | |
{ | |
"type": "section", | |
"text": {"type": "mrkdwn", "text": "GitHub Action 바로가기"}, | |
"accessory": { | |
"type": "button", | |
"text": {"type": "plain_text", "text": "${{ github.run_id }}"}, | |
"value": "github_action", | |
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | |
"action_id": "button-action" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |