Skip to content

Commit 45cd99c

Browse files
committed
fix: workflow
1 parent a40968c commit 45cd99c

File tree

1 file changed

+30
-18
lines changed

1 file changed

+30
-18
lines changed

.github/workflows/deploy.yml

+30-18
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,49 @@
1-
name: Deploy to GitHub Pages
1+
name: Deploy
22

33
on:
44
push:
55
branches:
6-
- main # Set a branch name to trigger deployment
6+
- main
77

88
jobs:
9-
deploy:
9+
build:
10+
name: Build
1011
runs-on: ubuntu-latest
12+
1113
steps:
12-
- uses: actions/checkout@v3
14+
- name: Checkout repo
15+
uses: actions/checkout@v3
1316

1417
- name: Setup Node
1518
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-
2619

2720
- name: Install dependencies
28-
run: npm ci
21+
uses: bahmutov/npm-install@v1
2922

30-
- name: Build
23+
- name: Build project
3124
run: npm run build
3225

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
3446
uses: peaceiris/actions-gh-pages@v3
3547
with:
3648
github_token: ${{ secrets.GITHUB_TOKEN }}
37-
publish_dir: ./build
49+
publish_dir: ./dist

0 commit comments

Comments
 (0)