File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Deploy Next.js to S3 and invalidate CloudFront
2+
3+ on :
4+ push :
5+ branches :
6+ - main # 또는 master, 프로젝트의 기본 브랜치 이름에 맞게 조정
7+ workflow_dispatch :
8+
9+ jobs :
10+ deploy :
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - name : Checkout repository
15+ uses : actions/checkout@v4
16+
17+ - name : Install dependencies
18+ run : npm ci
19+
20+ - name : Build
21+ run : npm run build
22+
23+ - name : Configure AWS credentials
24+ uses : aws-actions/configure-aws-credentials@v1
25+ with :
26+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
27+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
28+ aws-region : ${{ secrets.AWS_REGION }}
29+
30+ - name : Deploy to S3
31+ run : |
32+ aws s3 sync ./ s3://${{ secrets.S3_BUCKET_NAME }}/basic --delete --exclude ".github/*" --exclude ".gitignore"
33+
34+ - name : Invalidate CloudFront cache
35+ run : |
36+ aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"
You can’t perform that action at this time.
0 commit comments