Skip to content

Commit 5a116b7

Browse files
authored
Update deploy.yml
1 parent 9743ae3 commit 5a116b7

File tree

1 file changed

+38
-20
lines changed

1 file changed

+38
-20
lines changed

.github/workflows/deploy.yml

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,50 @@
1-
name: Deploy to GitHub Pages
1+
name: Deploy
22

33
on:
44
push:
55
branches:
6-
- "master"
7-
8-
permissions:
9-
contents: read
10-
pages: write
11-
id-token: write
6+
- main
127

138
jobs:
14-
deploy:
9+
build:
10+
name: Build
1511
runs-on: ubuntu-latest
12+
1613
steps:
17-
- name: Checkout code
18-
uses: actions/checkout@v4
14+
- name: Checkout repo
15+
uses: actions/checkout@v3
16+
17+
- name: Setup Node
18+
uses: actions/setup-node@v3
19+
20+
- name: Install dependencies
21+
uses: bahmutov/npm-install@v1
1922

20-
- name: Setup Node.js
21-
uses: actions/setup-node@v3
22-
with:
23-
node-version: '20.15.0'
23+
- name: Build project
24+
run: npm run build
2425

25-
- run: npm ci
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
2644

27-
- run: npm run build
28-
- id: build-publish
29-
uses: bitovi/github-actions-react-to-github-pages@v1.2.4
30-
with:
31-
path: dist
45+
- name: Deploy to GitHub Pages
46+
uses: peaceiris/actions-gh-pages@v3
47+
with:
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
publish_dir: ./dist
3250

0 commit comments

Comments
 (0)