-
Notifications
You must be signed in to change notification settings - Fork 5
137 lines (114 loc) · 4.66 KB
/
Doxygen.yml
File metadata and controls
137 lines (114 loc) · 4.66 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: doxygen
on:
push:
branches: main
workflow_dispatch:
inputs:
tag:
description: 'The ITK tag or hash with which to build the Doxygen documentation.'
required: false
default: 'master'
type: string
publish:
description: 'Create a GitHub release with the Doxygen documentation.'
required: true
default: 'false'
type: boolean
schedule:
- cron: '0 0 * * *'
jobs:
doxygen:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build Docker Image for Doxygen
run: |
docker build -f Dockerfile -t itk-doxygen .
- name: Configure Variables
id: vars
run: |
# if running workflow_dispatch, set the target branch to the tag input if set, otherwise set it to master
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
if [[ "${{ github.event.inputs.tag }}" != "" ]]; then
echo "branch=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
else
echo "branch=master" >> $GITHUB_ENV
fi
else
echo "branch=master" >> $GITHUB_ENV
fi
# Set publish to the input value if running workflow_dispatch, otherwise set it to true of running on main branch
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "publish=${{ github.event.inputs.publish }}" >> $GITHUB_ENV
echo "publish_tag=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "publish=true" >> $GITHUB_ENV
echo "publish_tag=latest" >> $GITHUB_ENV
else
echo "publish=false" >> $GITHUB_ENV
fi
- name: Docker Doxygen generation
env:
TAG: env.branch
run: |
docker run --env TAG --name itk-dox itk-doxygen
mkdir -p artifacts
docker cp itk-dox:/ITKDoxygen.tar.gz artifacts/ITKDoxygen-${GITHUB_SHA}.tar.gz
docker cp itk-dox:/ITKDoxygenXML.tar.gz artifacts/ITKDoxygenXML-${GITHUB_SHA}.tar.gz
- name: Archive Doxygen Artifacts
uses: actions/upload-artifact@v4
with:
name: doxygen
path: |
artifacts/ITKDoxygenXML-*.tar.gz
artifacts/ITKDoxygen-*.tar.gz
- name: Publish to latest GitHub Release
if: env.publish == 'true'
run: |
sudo apt install -y zstd
pushd artifacts
cp ITKDoxygen-*.tar.gz InsightDoxygenDocHtml-${publish_tag}.tar.gz
gunzip InsightDoxygenDocHtml-${publish_tag}.tar.gz
zstd -f -10 -T6 --long=31 InsightDoxygenDocHtml-${publish_tag}.tar -o InsightDoxygenDocHtml-${publish_tag}.tar.zst
gzip -9 InsightDoxygenDocHtml-${publish_tag}.tar
cp ITKDoxygenXML-*.tar.gz InsightDoxygenDocXml-${publish_tag}.tar.gz
gunzip InsightDoxygenDocXml-${publish_tag}.tar.gz
zstd -f -10 -T6 --long=31 InsightDoxygenDocXml-${publish_tag}.tar -o InsightDoxygenDocXml-${publish_tag}.tar.zst
gzip -9 InsightDoxygenDocXml-${publish_tag}.tar
popd
gh release delete -R InsightSoftwareConsortium/ITKDoxygen --cleanup-tag ${publish_tag} --yes
gh release create ${publish_tag} --notes="ITK Doxygen documentation built from the ITK main branch." --prerelease --title "ITKDoxygen ${publish_tag}" -R InsightSoftwareConsortium/ITKDoxygen ./artifacts/InsightDoxygen*
env:
GH_TOKEN: ${{ secrets.github_token }}
- name: Prepare HTML for GitHub Pages
if: github.ref == 'refs/heads/main'
run: |
tar -zxf artifacts/ITKDoxygen-*.tar.gz
touch html/.nojekyll
- name: Upload Pages artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: html
retention-days: 7
deploy-gh-pages:
needs: doxygen
runs-on: ubuntu-24.04
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
contents: read
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
id: deployment
uses: actions/deploy-pages@v4
# with:
# preview: true <-> currently not available to the public