Skip to content

Commit ac23d27

Browse files
committed
배포 파이프 라인 설정
1 parent 1c91869 commit ac23d27

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/deployment.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 "/*"

0 commit comments

Comments
 (0)