[FU-180] github actions code deploy connection #14
Workflow file for this run
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: Frontend Dev Server CD | |
on: | |
push: | |
branches: [ "develop" ] | |
pull_request: | |
branches: [ "develop" ] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check Node v # Node v 확인 | |
run: node -v | |
- name: Install Dependencies # 의존 파일 설치 | |
run: npm install | |
- name: Build # React Build | |
run: npm run build | |
- name: env 설정 | |
run: | | |
echo "AWS_REGION=${{ secrets.AWS_REGION }}" >> .env | |
echo "AWS_CODE_DEPLOY_APPLICATION=${{ secrets.AWS_CODE_DEPLOY_APPLICATION }}" >> .env | |
echo "AWS_ACCESS_KEY=${{ secrets.CICD_ACCESS_KEY }}" >> .env | |
echo "AWS_SECRET_KEY=${{ secrets.CICD_SECRET_KEY }}" >> .env | |
- name: 압축 | |
run: zip -r ./frontend_freebe.zip . | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.CICD_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.CICD_SECRET_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: S3에 zip 업로드(전체 파일) | |
run: aws s3 cp frontend_freebe.zip s3://cicd-frontend-develop-bucket/cicd-dev/frontend_freebe.zip --region ap-northeast-2 | |
- name: Code Deploy 로 배포 | |
run: > | |
aws deploy create-deployment --application-name ${{ secrets.AWS_CODE_DEPLOY_APPLICATION }} | |
--deployment-config-name CodeDeployDefault.AllAtOnce | |
--deployment-group-name cicd-front-develop-CD-group | |
--s3-location bucket=cicd-frontend-develop-bucket,bundleType=zip,key=cicd-dev/frontend_freebe.zip |