Skip to content

Commit 177d9a5

Browse files
committed
test GH Action to buld doc and upload
1 parent f087b35 commit 177d9a5

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Build docs, publish gh-pages, upload ZIP
2+
3+
on:
4+
push:
5+
branches:
6+
- 4.x
7+
pull_request:
8+
branches:
9+
- 4.x
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-docs:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
# pull-requests: write
18+
19+
steps:
20+
# 1. Checkout doc branch
21+
- name: Checkout current branch
22+
uses: actions/checkout@v4
23+
24+
# # 2. Checkout gh-pages branch
25+
# - name: Checkout gh-pages
26+
# uses: actions/checkout@v4
27+
# with:
28+
# ref: gh-pages
29+
# fetch-depth: 0
30+
# path: gh-pages
31+
32+
# 3. Java 8
33+
- name: Set up Java 8
34+
uses: actions/setup-java@v4
35+
with:
36+
distribution: temurin
37+
java-version: "8"
38+
39+
# 4. Python 3.10.1 + MkDocs + plugins
40+
- name: Set up Python 3.10.1
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: "3.10.1"
44+
45+
- name: Install MkDocs dependencies
46+
run: |
47+
python -m pip install --upgrade pip
48+
pip install \
49+
mkdocs \
50+
mkdocs-material \
51+
mkdocs-awesome-pages-plugin \
52+
mkdocs-macros-plugin
53+
54+
# 5. Build docs via build-doc.sh
55+
- name: Build documentation
56+
run: |
57+
chmod +x ./build-doc.sh
58+
./build-doc.sh
59+
60+
# 6. Upload built docs as a ZIP artifact
61+
# mkdocs.yml -> site_dir: docs, so output is doc/docs/
62+
- name: Archive built documentation
63+
run: |
64+
zip -r docs-built.zip docs
65+
66+
- name: Upload built doc artifact
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: built-docs-zip
70+
path: docs-built.zip
71+
retention-days: 10
72+
73+
# 7. Replace content in gh-pages branch
74+
# - name: Sync docs into gh-pages
75+
# run: |
76+
# cd gh-pages
77+
# find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} +
78+
# cd ..
79+
# cp -R doc/docs/* gh-pages/
80+
#
81+
# # 8. Commit changes to gh-pages
82+
# - name: Commit and push to gh-pages
83+
# working-directory: gh-pages
84+
# run: |
85+
# git config user.name "github-actions[bot]"
86+
# git config user.email "github-actions[bot]@users.noreply.github.com"
87+
#
88+
# git add .
89+
#
90+
# if git diff --cached --quiet; then
91+
# echo "No changes to push to gh-pages."
92+
# exit 0
93+
# fi
94+
#
95+
# git commit -m "Update generated docs"
96+
# git push origin gh-pages
97+
#
98+
# # 9. Create or update PR: gh-pages-pr -> gh-pages
99+
# - name: Create or update gh-pages PR
100+
# uses: peter-evans/create-pull-request@v7
101+
# with:
102+
# token: ${{ secrets.GITHUB_TOKEN }}
103+
# path: gh-pages
104+
# branch: gh-pages-pr
105+
# base: gh-pages
106+
# commit-message: "Update generated docs"
107+
# title: "Update generated docs on gh-pages"
108+
# body: |
109+
# This PR updates the `gh-pages` branch with the latest generated documentation.
110+
# A downloadable ZIP of the built docs is also available in the workflow artifacts.

0 commit comments

Comments
 (0)