-
-
Notifications
You must be signed in to change notification settings - Fork 272
52 lines (50 loc) · 1.5 KB
/
website.yaml
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
name: website
on:
push:
branches:
- master
paths:
- 'www/docs/*.md'
- 'www/docs/web/*.md'
- 'www/website/*'
jobs:
build:
env:
WWW_TARGET_BRANCH: gh-pages
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Build webpage
run: |
npm ci
npm run build
working-directory: ./www/website
- name: Copy data
run: |
mkdir -p ${{env.HOME}}/tmp/www/build
cp -r ./www/website/build/ghz/. ${{env.HOME}}/tmp/www/build
- name: Check out target branch
uses: actions/checkout@v3
with:
ref: ${{ env.WWW_TARGET_BRANCH }}
- name: Copy new data
run: |
cp -r ${{env.HOME}}/tmp/www/build/. .
- name: Commit to repository
env:
GITHUB_TOKEN: ${{ secrets.GH_PAGES_ACTION_TOKEN }}
COMMIT_MSG: Update website
run: |
git config user.email "[email protected]"
git config user.name "Bojan"
# Update origin with token
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
# Add changed files
git add .
# Only commit and push if we have changes
git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin ${WWW_TARGET_BRANCH})