generated from cybozu-go/neco-template
-
Notifications
You must be signed in to change notification settings - Fork 22
50 lines (50 loc) · 1.25 KB
/
mdbook.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
name: Book
on:
pull_request:
push:
branches:
- 'main'
jobs:
build:
name: Build book
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- run: make book
- uses: actions/upload-artifact@v4
with:
name: book
path: docs/book
retention-days: 1
publish:
name: Publish book on GitHub Pages
runs-on: ubuntu-22.04
needs: build
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages
# ignore helm chart index file and chart archive file.
- run: ls | grep -v -E 'index.yaml|moco-.*\.tgz' | xargs rm -rf
- uses: actions/download-artifact@v4
with:
name: book
- run: ls -R
- run: git add .
- name: Check diff
run: |
diffs=$(git status -s)
if [ "$diffs" = "" ]; then
echo "NO_DIFF=1" >> $GITHUB_ENV
else
printf "%s\n" "$diffs"
fi
- name: Commit changes
if: env.NO_DIFF != '1'
run: |
git config --global user.name 'Cybozu Neco'
git config --global user.email 'cybozu-neco@users.noreply.github.com'
git commit -m 'update'
- name: Push to gh-pages
if: github.ref == 'refs/heads/main' && env.NO_DIFF != '1'
run: git push origin gh-pages