This repository was archived by the owner on Sep 25, 2025. It is now read-only.
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.yaml' | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - 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 NodeJS | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install AWS CLI | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y awscli | |
| - 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 "/*" |