-
Notifications
You must be signed in to change notification settings - Fork 2
132 lines (122 loc) · 3.65 KB
/
ci.yml
File metadata and controls
132 lines (122 loc) · 3.65 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: CI
on:
push:
branches: [main, migration, rc]
pull_request:
branches: [main, migration]
release:
types: [created]
env:
NODE_VERSION: 18
jobs:
format-and-lint:
name: Format and Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Install yarn dependencies
run: yarn install
- name: Format
run: yarn prettier
- name: Lint
run: yarn lint
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Install yarn dependencies
run: yarn install
- name: Build
run: yarn build
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Install yarn dependencies
run: yarn install
- name: Run tests
run: yarn coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: sparcs-kaist/otlplus-web
deploy-dev:
name: Build and Deploy to Dev
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/rc' && github.event_name == 'push'
needs: [format-and-lint, build, test]
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Install yarn dependencies
run: yarn install
- name: Build
run: yarn build
env:
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN_DEV }}
VITE_DEV_MODE: true
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
- name: Upload to S3 Dev
run: |
aws s3 sync build/ s3://otl-plus-dev/ --delete
echo "Uploaded build files to S3 Dev: s3://otl-plus-dev/"
release-and-upload:
name: Build and Upload Release Asset
runs-on: ubuntu-latest
if: github.event_name == 'release'
needs: [format-and-lint]
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Install yarn dependencies
run: yarn install
- name: Build
run: yarn build
env:
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN_PROD }}
VITE_DEV_MODE: false
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2 # Seoul region, adjust as needed
- name: Upload to S3
run: |
aws s3 sync build/ s3://otl.sparcs.org-1/${{ github.event.release.tag_name }}/ --delete
echo "Uploaded build files to S3: s3://otl.sparcs.org-1/${{ github.event.release.tag_name }}/"