This repository has been archived by the owner on Oct 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
63 lines (55 loc) · 1.82 KB
/
publish.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
53
54
55
56
57
58
59
60
61
62
63
name: Publish
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
# Check out the content (source branch)
- name: Check out source
uses: actions/checkout@v2
# Check out the `gh-pages` branch into the `public` directory.
- name: Check out documentation branch
uses: actions/checkout@v2
with:
ref: 'gh-pages'
path: 'docs/public'
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
# Update npm to latest
- name: Update npm to latest
run: npm install -g npm@latest
# Build the site
- name: Install npm packages
run: npm install
- name: Build documentation
run: npm run build
env:
PREFIX_PATHS: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Check for changes; this avoids publishing a new change to the
# gh-pages branch when we made a change to (for example) a unit test.
# If there were changes made in the publish step above, then this
# will set the variable `has_changes` to `1` for subsequent steps.
- name: Check for changes
id: status
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "::set-output name=has_changes::1"
fi
working-directory: docs/public
# Commit the changes to the gh-pages branch and push the changes up to
# GitHub. (Replace the name and email address with your own.)
# This step only runs if the previous step set `has_changes` to `1`.
- name: Publish documentation
run: |
git add --verbose .
git config user.name 'CI User'
git config user.email 'noreply@npmjs.com'
git commit -m 'Update from CI'
git push origin gh-pages
if: steps.status.outputs.has_changes == '1'
working-directory: docs/public