Skip to content

Commit

Permalink
ci: workflow.yml 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeseon-han committed Dec 20, 2023
1 parent c9f71b6 commit 33326cf
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,20 @@ name: Production-CI/CD
on:
push:
branches: [main]

env:
S3_BUCKET_NAME: ddd-mara
CODE_DEPLOY_APPLICATION_NAME: ddd-code-deploy
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: ddd

jobs:
build:
runs-on: ubuntu-latest # 3 실행 환경 지정

strategy:
matrix:
node-version: [18.x]

#4 실행스텝지정
steps:
- name: Checkout source code.
Expand All @@ -17,3 +28,26 @@ jobs:
run: yarn install --frozen-lockfile
- name: Build
run: yarn build

- name: Make zip file
run: zip -qq -r ./$GITHUB_SHA.zip . -x "node_modules/*"
shell: bash

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2

- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$GITHUB_SHA.zip

- name: Code Deploy
run: |
aws deploy create-deployment \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \
--s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=$GITHUB_SHA.zip

0 comments on commit 33326cf

Please sign in to comment.