-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (44 loc) · 1.58 KB
/
deploy-admin.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Deploy Admin Page to AWS
on:
pull_request:
branches: ["develop"]
types: ["closed"]
workflow_dispatch:
env:
AWS_REGION: ap-northeast-2
ADMIN_BUCKET_NAME: v-admin.gdsc-knu.com
permissions:
contents: read
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install yarn
run: |
npm install -g yarn
- name: Create .env file
run: |
echo "VITE_APP_BASE_URL=${{ secrets.VITE_APP_BASE_URL }}" >> .env
- name: Install Dependencies
run: yarn admin install
- name: Build
run: yarn admin build
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ADMIN_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_ADMIN_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Upload to AWS S3
env:
BUCKET_NAME: ${{env.ADMIN_BUCKET_NAME}}
run: aws s3 sync packages/admin/dist s3://$BUCKET_NAME --delete
- name: Invalidate Cloudfront Cache
run: aws cloudfront create-invalidation --distribution-id ${{secrets.ADMIN_CLOUDFRONT_ID}} --paths /*