-
Notifications
You must be signed in to change notification settings - Fork 37
33 lines (33 loc) · 1020 Bytes
/
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
# Build the website and pushes it to the gh-pages branch
name: Publish
on:
push:
branches:
- 'master'
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- run: yarn install
- run: yarn build
- name: Remove all files except dist
run: |
mv docs/.vuepress/dist dist
shopt -s extglob
rm -r -f !("dist")
- name: Commit to gh-pages branch
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git checkout --orphan gh-pages
shopt -s extglob
rm -r -f !("dist")
mv dist/* .
git reset
git add *
git diff --quiet && git diff --staged --quiet || git commit -am "Build new version of website"
git push --set-upstream --force origin gh-pages