1- name : Doxygen Pages
1+ # .github/workflows/doxygen.yml
2+ name : Doxygen Docs
23
4+ # ───────────────────────────────
5+ # ➊ Run on every push (any branch / tag) and on every PR
6+ # ───────────────────────────────
37on :
4- push : # run on every push (all branches)
5- branches : ["**"]
6- pull_request : # optional – still produces the artifact
8+ push :
9+ branches : ["**"] # “**” means *all* branches & tags
10+ pull_request : # keeps lint / warnings visible in PRs
711
12+ # ───────────────────────────────
13+ # ➋ The workflow needs to push to gh-pages
14+ # so we grant the default token “contents: write”
15+ # ───────────────────────────────
816permissions :
9- contents : read
10- pages : write # allow the deploy-pages action to publish
11- id-token : write # required by deploy-pages
17+ contents : write # required by peaceiris/actions-gh-pages
1218
1319jobs :
1420 docs :
1521 runs-on : ubuntu-latest
1622
1723 steps :
18- - uses : actions/checkout@v4
24+ # ───────────────────────────
25+ # Check out the current commit
26+ # ───────────────────────────
27+ - name : Checkout source
28+ uses : actions/checkout@v4
1929
20- - name : Install Doxygen + Graphviz
21- run : sudo apt-get update && sudo apt-get install -y doxygen graphviz
30+ # ───────────────────────────
31+ # Install Doxygen + Graphviz
32+ # ───────────────────────────
33+ - name : Install Doxygen & Graphviz
34+ run : |
35+ sudo apt-get update -y
36+ sudo apt-get install -y doxygen graphviz
2237
23- - name : Generate docs
24- run : doxygen Doxyfile # OUTPUT_DIRECTORY = docs
38+ # ───────────────────────────
39+ # Build the manual – assumes your “Doxyfile” puts
40+ # everything inside docs/html/
41+ # ───────────────────────────
42+ - name : Generate documentation
43+ run : doxygen Doxyfile
2544
26- # 1️⃣ Upload the generated site as a Pages artifact
27- - name : Upload Pages artifact
28- uses : actions/upload-pages-artifact@v2
29- with :
30- path : docs/html # <— exact folder with index.html
45+ # ───────────────────────────
46+ # Turn the branch / tag name into something
47+ # safe for file-systems (slash → underscore)
48+ # ───────────────────────────
49+ - name : Compute safe name
50+ id : ref
51+ run : echo "SAFE_NAME=${GITHUB_REF_NAME//\//_}" >> "$GITHUB_OUTPUT"
3152
32- # 2️⃣ Deploy the artifact to GitHub Pages
33- deploy :
34- needs : docs
35- runs-on : ubuntu-latest
36- environment :
37- name : github-pages
38- url : ${{ steps.deployment.outputs.page_url }}
39- steps :
40- - name : Deploy to GitHub Pages
41- id : deployment
42- uses : actions/deploy-pages@v2
53+ # ───────────────────────────
54+ # Upload the HTML as a workflow artefact
55+ # (handy for PRs – click “Artifacts”)
56+ # ───────────────────────────
57+ - name : Upload artifact
58+ uses : actions/upload-artifact@v4
59+ with :
60+ name : docs-${{ steps.ref.outputs.SAFE_NAME }}
61+ path : docs/html
62+ retention-days : 14 # keep for two weeks (optional)
63+
64+ # ───────────────────────────
65+ # Deploy **only on pushes** (not on PR builds)
66+ # to gh-pages/<branch-or-tag-name>/
67+ # ───────────────────────────
68+ - name : Deploy to GitHub Pages
69+ if : github.event_name == 'push'
70+ uses : peaceiris/actions-gh-pages@v4
71+ with :
72+ github_token : ${{ secrets.GITHUB_TOKEN }}
73+ publish_branch : gh-pages
74+ publish_dir : docs/html
75+ destination_dir : ${{ steps.ref.outputs.SAFE_NAME }}
0 commit comments