Skip to content

Commit c9db328

Browse files
committed
ENH: Add GitHub workflow to trigger build and publish of Doxygen
1 parent 423c46a commit c9db328

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Trigger Doxygen Build and Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v*
9+
10+
pull_request:
11+
12+
# Allows running this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
inputs:
15+
slicer_repository:
16+
description: "Slicer Repository for which to build and publish the documentation"
17+
default: Slicer/Slicer
18+
slicer_ref:
19+
description: "Slicer Branch or tag for which to build and publish the documentation"
20+
default: main
21+
preview:
22+
description: "Publish at https://preview.apidocs.slicer.org"
23+
default: false
24+
type: boolean
25+
26+
permissions:
27+
actions: write
28+
29+
jobs:
30+
doxygen-build-and-publish:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Collect Inputs
34+
id: collect_inputs
35+
run: |
36+
echo "EVENT_NAME [$EVENT_NAME]"
37+
if [[ "$EVENT_NAME" == "push" ]]; then
38+
slicer_repository=${{ github.repository }}
39+
40+
github_ref=${{ github.ref }}
41+
echo "github_ref [$github_ref]"
42+
# Strip 'refs/heads/' or 'refs/tags/' from the start of the string
43+
slicer_ref="${github_ref#refs/heads/}"
44+
slicer_ref="${slicer_ref#refs/tags/}"
45+
46+
preview="false"
47+
48+
elif [[ "$EVENT_NAME" == "pull_request" ]]; then
49+
slicer_repository=${{ github.event.pull_request.head.ref }}
50+
slicer_ref=${{ github.event.pull_request.head.repo.full_name }}
51+
preview="true"
52+
53+
elif [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then
54+
slicer_repository=${{ github.event.inputs.slicer_repository }}
55+
slicer_ref=${{ github.event.inputs.ref }}
56+
preview=${{ github.event.inputs.preview }}
57+
58+
else
59+
echo "::error ::Unsupported EVENT_NAME [$EVENT_NAME]"
60+
exit 1
61+
fi
62+
63+
echo "slicer_repository [$slicer_repository]"
64+
echo "slicer_repository=$slicer_repository" >> $GITHUB_OUTPUT
65+
66+
echo "slicer_ref [$slicer_ref]"
67+
echo "slicer_ref=$slicer_ref" >> $GITHUB_OUTPUT
68+
69+
echo "preview [$preview]"
70+
echo "preview=$preview" >> $GITHUB_OUTPUT
71+
env:
72+
EVENT_NAME: ${{ github.event_name }}
73+
74+
- uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1
75+
id: app-token
76+
with:
77+
app-id: ${{ vars.SLICER_APP_ID }}
78+
private-key: ${{ secrets.SLICER_APP_PRIVATE_KEY }}
79+
owner: Slicer
80+
repositories: |
81+
apidocs.slicer.org
82+
preview.apidocs.slicer.org
83+
84+
- name: Trigger Workflow
85+
run: |
86+
gh workflow run doxygen-build-and-publish.yml \
87+
-f slicer_repository=$SLICER_REPOSITORY \
88+
-f slicer_ref=$SLICER_REF \
89+
-f preview=$PREVIEW \
90+
--repo "Slicer/apidocs.slicer.org"
91+
env:
92+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
93+
SLICER_REPOSITORY: ${{ steps.collect_inputs.outputs.slicer_repository }}
94+
SLICER_REF: ${{ steps.collect_inputs.outputs.slicer_ref }}
95+
PREVIEW: ${{ steps.collect_inputs.outputs.preview }}

0 commit comments

Comments
 (0)