This repository was archived by the owner on Sep 25, 2025. It is now read-only.
updated Front #7
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 S3 static website (React Build) | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'frontend/**' | |
| - '.github/workflows/aws-deploy-fe.yml' | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v2 | |
| 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: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| - name: Install Serverless Framework v3 | |
| run: npm install -g serverless@3.40.0 | |
| - name: Install Serverless plugin dependencies | |
| run: npm install -g serverless-s3-sync serverless-cloudfront-invalidate | |
| - name: Install dependencies | |
| run: | | |
| cd frontend | |
| npm install | |
| - name: Build React app | |
| run: | | |
| cd frontend | |
| npm run build | |
| - name: Upload to S3 | |
| run: | | |
| cd frontend | |
| aws s3 sync dist/ s3://${{ secrets.S3_BUCKET_NAME }} --delete | |
| - name: Invalidate CloudFront cache | |
| run: | | |
| aws cloudfront create-invalidation \ | |
| --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \ | |
| --paths "/*" |