Merge pull request #29 from ije90s/dev #14
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: CI/CD Test With CodeDeploy | |
| on: | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'npm' | |
| - name: Install Package | |
| run: npm ci | |
| - name: Test | |
| run: npm test | |
| - name: Build | |
| run: npm run build | |
| - name: $GITHUB_SHA Confirm | |
| run: echo $GITHUB_SHA | |
| - name: Zip | |
| run: tar -czf $GITHUB_SHA.tar.gz appspec.yml scripts dist package.json package-lock.json ecosystem.config.js | |
| - name: AWS credentials 설정 | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-region: ap-northeast-2 | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| - name: S3 Upload | |
| run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.tar.gz s3://challenge-api-ci-cd/$GITHUB_SHA.tar.gz | |
| - name: Code Deploy | |
| run: | | |
| aws deploy create-deployment \ | |
| --application-name challenge-api \ | |
| --deployment-config-name CodeDeployDefault.AllAtOnce \ | |
| --deployment-group-name Production \ | |
| --s3-location bucket=challenge-api-ci-cd,bundleType=tgz,key=$GITHUB_SHA.tar.gz | |