#28 fix: 환경 변수 수정 #24
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 Frontend to S3 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| - feature/* | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| - name: Install dependencies | |
| run: | | |
| cd frontend | |
| npm install | |
| - name: Build frontend | |
| run: | | |
| cd frontend | |
| npm run build | |
| - name: Upload to S3 | |
| uses: jakejarvis/s3-sync-action@v0.5.1 | |
| with: | |
| args: --acl public-read --delete | |
| env: | |
| AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_REGION: "ap-northeast-2" | |
| SOURCE_DIR: "frontend/dist" | |
| - name: Install AWS CLI | |
| run: | | |
| sudo apt update | |
| sudo apt install -y awscli | |
| - name: Invalidate CloudFront cache | |
| run: | | |
| aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*" | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |