Skip to content

Commit c8e0b7b

Browse files
committed
ci: Add GitHub Workflow to build and publish documentation
1 parent 7714c1a commit c8e0b7b

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

.github/workflows/build-doxygen.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Build and Publish
2+
3+
on:
4+
# Allows running this workflow manually from the Actions tab
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: "Version of Slicer documentation to build and publish"
9+
required: true
10+
11+
permissions:
12+
# Needed in the publish step to update gh-pages branch
13+
contents: write
14+
15+
jobs:
16+
build-and-publish:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Collect Inputs
20+
id: collect_inputs
21+
run: |
22+
echo "EVENT_NAME [$EVENT_NAME]"
23+
if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then
24+
version=${{ github.event.inputs.version }}
25+
else
26+
echo "::error ::Unsupported EVENT_NAME [$EVENT_NAME]"
27+
exit 1
28+
fi
29+
echo "version=$version" >> $GITHUB_OUTPUT
30+
env:
31+
EVENT_NAME: ${{ github.event_name }}
32+
33+
- uses: actions/checkout@v4
34+
with:
35+
ref: gh-pages
36+
path: gh-pages
37+
38+
- uses: actions/checkout@v4
39+
with:
40+
repository: jcfr/Slicer
41+
path: Slicer
42+
ref: speedup-doxygen-generation # ${{ steps.collect_inputs.outputs.version }}
43+
44+
- uses: ssciwr/doxygen-install@v1
45+
with:
46+
version: "1.10.0"
47+
48+
# The "dot" binary is provided by Graphviz
49+
- uses: ts-graphviz/setup-graphviz@v2
50+
51+
- uses: actions/checkout@v4
52+
with:
53+
repository: Slicer/slicer-apidocs-builder
54+
path: slicer-apidocs-builder
55+
ref: 1744509e91fa66186d34e4c6968ee684131c51d1
56+
57+
- uses: actions/setup-python@v5
58+
with:
59+
python-version: '3.13'
60+
cache: 'pip'
61+
62+
- name: Install slicer-apidocs-builder
63+
run: |
64+
pip install ./slicer-apidocs-builder
65+
66+
- name: Generate Documentation
67+
run: |
68+
slicer-apidocs-builder \
69+
--skip-publish \
70+
--slicer-repo-dir Slicer \
71+
--slicer-repo-branch "$SLICER_REPO_BRANCH" \
72+
--slicer-repo-tag "${SLICER_REPO_TAG}"
73+
env:
74+
SLICER_REPO_BRANCH: speedup-doxygen-generation # ${{ steps.collect_inputs.outputs.version }}
75+
SLICER_REPO_TAG: ""
76+
77+
- uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1
78+
id: app-token
79+
with:
80+
app-id: ${{ vars.SLICER_APP_ID }}
81+
private-key: ${{ secrets.SLICER_APP_PRIVATE_KEY }}
82+
83+
- name: Publish documentation
84+
run: |
85+
slicer-apidocs-builder \
86+
--skip-build \
87+
--slicer-repo-name ${SLICER_REPO_NAME} \
88+
--slicer-repo-branch "${SLICER_REPO_BRANCH}" \
89+
--slicer-repo-tag "${SLICER_REPO_TAG}" \
90+
--publish-github-repo-name "Slicer/${PUBLISH_GITHUB_PROJECT_NAME}" \
91+
--publish-github-repo-branch gh-pages
92+
env:
93+
PUBLISH_GITHUB_PROJECT_NAME: apidocs.slicer.org
94+
PUBLISH_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
95+
SLICER_REPO_NAME: Slicer/Slicer
96+
SLICER_REPO_BRANCH: ${{ steps.collect_inputs.outputs.version }}
97+
SLICER_REPO_TAG: ""
98+

0 commit comments

Comments
 (0)