Update example.md #9
This file contains 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: FE Build and Deploy for Dev | |
on: | |
push: | |
branches: | |
- test/fe-cd # develop 브랜치에서만 실행 | |
paths: | |
- 'frontend/**' # frontend 폴더가 변경된 경우에만 실행 | |
jobs: | |
build: | |
name: FE Build for Dev | |
runs-on: ubuntu-latest | |
steps: | |
# 1. Repository Checkout | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# 2. Install Dependencies | |
- name: Install Dependencies | |
working-directory: ./frontend | |
run: npm install | |
# 3. Build Project | |
- name: Build for Dev | |
working-directory: ./frontend | |
run: npm run build:dev | |
# 4. Upload Build Artifact | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: frontend-build-dev | |
path: ./frontend/dist | |
deploy: | |
name: FE Deploy for Dev | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
# 1. Download Build Artifact | |
- name: Download Build Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: frontend-build-dev | |
# 2. Configure AWS CLI | |
- name: Configure AWS CLI | |
run: | | |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws configure set default.region ${{ secrets.AWS_REGION }} | |
# 3. Upload to S3 | |
- name: Upload to S3 (Dev) | |
run: | | |
aws s3 sync ./frontend/dist s3://${{ secrets.AWS_S3_BUCKET_DEV }} --delete | |
# 4. Invalidate CloudFront Cache | |
- name: Invalidate CloudFront Cache (Dev) | |
run: | | |
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID_DEV }} --paths "/*" |