Skip to content

Commit 4e1d11e

Browse files
committed
chore: deploy.yml 추가
1 parent 177f8cf commit 4e1d11e

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: MAIN CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
Deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout source code
14+
uses: actions/checkout@v3
15+
16+
- name: Get pnpm store path
17+
id: pnpm-cache-path
18+
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV
19+
20+
- name: Cache pnpm modules
21+
id: cache
22+
uses: actions/cache@v3
23+
with:
24+
path: ${{ env.STORE_PATH }}
25+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
26+
restore-keys: |
27+
${{ runner.os }}-pnpm-
28+
${{ runner.os }}-
29+
30+
- name: Install Dependencies
31+
if: steps.cache.outputs.cache-hit != 'true'
32+
run: |
33+
pnpm install --frozen-lockfile
34+
pnpm store prune
35+
36+
- name: Build
37+
run: pnpm run build
38+
39+
- name: Configure AWS Credentials
40+
uses: aws-actions/configure-aws-credentials@v2
41+
with:
42+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
43+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
44+
aws-region: ${{ secrets.AWS_REGION }}
45+
46+
- name: Deploy to S3
47+
run: aws s3 sync ./build s3://${{ secrets.AWS_BUCKET_NAME }} --delete
48+
49+
- name: Invalidate CloudFront Cache
50+
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} --paths "/*"

0 commit comments

Comments
 (0)