-
Notifications
You must be signed in to change notification settings - Fork 42
52 lines (43 loc) · 1.08 KB
/
publish-gh-pages.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
on:
push:
branches:
- main
workflow_dispatch: {}
name: Publish to GitHub Pages
jobs:
deploy_ui:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: main
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache-dependency-path: 'main/package-lock.json'
- name: Install dependencies
run: |
cd main
npm ci
- name: Build
run: |
cd main
NODE_ENV=production npm run build
- uses: actions/checkout@v4
with:
ref: gh-pages
path: pages
- name: Commit Build to gh-pages
run: |
cp -R main/dist/* pages/
cd pages
HAS_CHANGES=$(git diff)
if [ -n "$HAS_CHANGES" ]; then
git config user.name 'GH Actions Bot'
git config user.email '[email protected]'
git add .
git commit -m 'Update gh-pages site code from main branch'
git push
fi