feat: remove content and write title #2
This file contains 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: 🚨 프로덕션 환경 React App CI/CD | |
on: | |
push: | |
branches: | |
- main | |
env: | |
ENVIRONMENT: prod | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Node.js ${{ matrix.node-version }} 사용 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: | | |
- recursive: true | |
args: [--frozen-lockfile, --strict-peer-dependencies, --ignore-scripts] | |
- args: [--global, gulp, prettier, typescript] | |
- name: env 파일 생성 | |
run: | | |
touch .env | |
echo VITE_REACT_APP_GA_KEY=${{ secrets.VITE_REACT_APP_GA_KEY }} >> .env | |
echo VITE_PUBLIC_API_URL=${{ secrets.VITE_PUBLIC_API_URL }} >> .env | |
cat .env | |
#################################################################################################### | |
# APPLY MODULE | |
#################################################################################################### | |
- name: Apply 모듈 pnpm 빌드 | |
run: | | |
pnpm build:apply | |
- name: service-apply 모듈 배포 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
run: | | |
aws s3 sync dist/service-apply s3://${{ secrets.AWS_APPLY_WS_BUCKET_NAME }} | |
- name: Apply 모듈 Slack 성공 알림 | |
if: success() | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: custom | |
fields: author, workflowRun, pullRequest | |
custom_payload: | | |
{ | |
attachments: [{ | |
color: '#50CAF1', | |
title: '서버 배포 알림', | |
text: `🏃♂️➡️ 프로덕션 환경 Apply 모듈 CICD 진행 완료!`, | |
fields: [ | |
{ | |
title: '배포 환경', | |
value: `${process.env.ENVIRONMENT}`, | |
short: true, | |
}, | |
{ | |
title: '배포자', | |
value: `${process.env.AS_AUTHOR}`, | |
short: true, | |
}, | |
{ | |
title: '워크플로 링크', | |
value: `${process.env.AS_WORKFLOW_RUN}`, | |
short: true, | |
}, | |
{ | |
title: 'PR 링크', | |
value: `${process.env.AS_PULL_REQUEST}`, | |
short: true, | |
} | |
] | |
}] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEPLOY_WEBHOOK_URL }} | |
- name: Apply 모듈 Slack 실패 알림 | |
if: failure() | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: custom | |
fields: author, workflowRun, pullRequest | |
custom_payload: | | |
{ | |
attachments: [{ | |
color: '#CA0025', | |
title: '서버 배포 알림', | |
text: `🧎♂️➡️ 프로덕션 환경 Apply 모듈 CICD 진행 실패!`, | |
fields: [ | |
{ | |
title: '배포 환경', | |
value: `${process.env.ENVIRONMENT}`, | |
short: true, | |
}, | |
{ | |
title: '배포자', | |
value: `${process.env.AS_AUTHOR}`, | |
short: true, | |
}, | |
{ | |
title: '워크플로 링크', | |
value: `${process.env.AS_WORKFLOW_RUN}`, | |
short: true, | |
}, | |
{ | |
title: 'PR 링크', | |
value: `${process.env.AS_PULL_REQUEST}`, | |
short: true, | |
} | |
] | |
}] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEPLOY_WEBHOOK_URL }} | |
#################################################################################################### | |
# MANAGER MODULE | |
#################################################################################################### | |
- name: Manager 모듈 pnpm 빌드 | |
run: | | |
pnpm build:manager | |
- name: service-manager 모듈 배포 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
SOURCE_DIR: 'dist/service-manager' | |
run: | | |
aws s3 sync dist/service-manager s3://${{ secrets.AWS_MANAGER_WS_BUCKET_NAME }} | |
- name: Manager 모듈 Slack 성공 알림 | |
if: success() | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: custom | |
fields: author, workflowRun, pullRequest | |
custom_payload: | | |
{ | |
attachments: [{ | |
color: '#50CAF1', | |
title: `🏃♂️➡️ 프로덕션 환경 Apply 모듈 CICD 진행 완료!`, | |
fields: [ | |
{ | |
title: '배포 환경', | |
value: `${process.env.ENVIRONMENT}`, | |
short: true, | |
}, | |
{ | |
title: '배포자', | |
value: `${process.env.AS_AUTHOR}`, | |
short: true, | |
}, | |
{ | |
title: '워크플로 링크', | |
value: `${process.env.AS_WORKFLOW_RUN}`, | |
short: true, | |
}, | |
{ | |
title: 'PR 링크', | |
value: `${process.env.AS_PULL_REQUEST}`, | |
short: true, | |
} | |
] | |
}] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEPLOY_WEBHOOK_URL }} | |
- name: Manager 모듈 Slack 실패 알림 | |
if: failure() | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: custom | |
fields: author, workflowRun, pullRequest | |
custom_payload: | | |
{ | |
attachments: [{ | |
color: '#CA0025', | |
title: `🧎♂️➡️ 프로덕션 환경 Apply 모듈 CICD 진행 실패!`, | |
fields: [ | |
{ | |
title: '배포 환경', | |
value: `${process.env.ENVIRONMENT}`, | |
short: true, | |
}, | |
{ | |
title: '배포자', | |
value: `${process.env.AS_AUTHOR}`, | |
short: true, | |
}, | |
{ | |
title: '워크플로 링크', | |
value: `${process.env.AS_WORKFLOW_RUN}`, | |
short: true, | |
}, | |
{ | |
title: 'PR 링크', | |
value: `${process.env.AS_PULL_REQUEST}`, | |
short: true, | |
} | |
] | |
}] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEPLOY_WEBHOOK_URL }} |