File tree 1 file changed +30
-18
lines changed
1 file changed +30
-18
lines changed Original file line number Diff line number Diff line change 1
- name : Deploy to GitHub Pages
1
+ name : Deploy
2
2
3
3
on :
4
4
push :
5
5
branches :
6
- - main # Set a branch name to trigger deployment
6
+ - main
7
7
8
8
jobs :
9
- deploy :
9
+ build :
10
+ name : Build
10
11
runs-on : ubuntu-latest
12
+
11
13
steps :
12
- - uses : actions/checkout@v3
14
+ - name : Checkout repo
15
+ uses : actions/checkout@v3
13
16
14
17
- name : Setup Node
15
18
uses : actions/setup-node@v3
16
- with :
17
- node-version : ' 18'
18
-
19
- - name : Cache dependencies
20
- uses : actions/cache@v3
21
- with :
22
- path : ~/.npm
23
- key : ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
24
- restore-keys : |
25
- ${{ runner.OS }}-node-
26
19
27
20
- name : Install dependencies
28
- run : npm ci
21
+ uses : bahmutov/ npm-install@v1
29
22
30
- - name : Build
23
+ - name : Build project
31
24
run : npm run build
32
25
33
- - name : Deploy
26
+ - name : Upload production-ready build files
27
+ uses : actions/upload-artifact@v3
28
+ with :
29
+ name : production-files
30
+ path : ./dist
31
+
32
+ deploy :
33
+ name : Deploy
34
+ needs : build
35
+ runs-on : ubuntu-latest
36
+ if : github.ref == 'refs/heads/main'
37
+
38
+ steps :
39
+ - name : Download artifact
40
+ uses : actions/download-artifact@v3
41
+ with :
42
+ name : production-files
43
+ path : ./dist
44
+
45
+ - name : Deploy to GitHub Pages
34
46
uses : peaceiris/actions-gh-pages@v3
35
47
with :
36
48
github_token : ${{ secrets.GITHUB_TOKEN }}
37
- publish_dir : ./build
49
+ publish_dir : ./dist
You can’t perform that action at this time.
0 commit comments