-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (58 loc) · 1.96 KB
/
build_docs.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# This workflow will rebuild YARD docs and update the gh-pages branch.
name: Build Documentation
on:
push:
branches: [ main, docs ]
jobs:
build:
name: Rebuild YARD docs and update the gh-pages branch
runs-on: ubuntu-latest
steps:
- name: Extract branch name
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Show branch name
run: echo "The branch name is $BRANCH_NAME"
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Ruby and Gems
uses: ruby/setup-ruby@v1
env:
BUNDLE_WITH: documentation
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Set git indentity
run: |
git config user.name "GitHub Action"
git config user.email "<>"
- name: Update YARD html
run: bundle exec yardoc --output docs/dev
- name: Update YARD markdown
run: bundle exec yardoc --template jekyll --format markdown --output docs/tests
- name: Commit to local branch
run: |
git add docs -f
git commit -m "update docs"
- name: Checkout changes from docs folder to local gh-pages branch
run: |
git checkout gh-pages
git checkout $BRANCH_NAME -- docs
- name: Check for changes
run: |
if git diff --cached --quiet; then
echo "git_changes=false" >> $GITHUB_ENV
else
echo "git_changes=true" >> $GITHUB_ENV
fi
- name: Commit changes in docs folder to local gh-pages branch
if: env.git_changes == 'true'
run: |
git add docs -f
git commit -m "update docs"
- name: Push changes
if: env.git_changes == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages