-
Notifications
You must be signed in to change notification settings - Fork 1.1k
185 lines (149 loc) · 4.59 KB
/
documentation.yml
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Documentation
on:
push:
branches-ignore:
- coverity_scan
- run-fuzzer**
- debug-fuzzer-**
paths:
- '.github/workflows/documentation.yml'
- 'doc/**'
- 'man/**'
- 'raddb/**'
- 'share/**'
pull_request:
paths:
- '.github/workflows/documentation.yml'
- 'doc/**'
- 'man/**'
- 'raddb/**'
- 'share/**'
jobs:
build-docs:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install common build dependencies
run: |
sudo apt-get install -y --no-install-recommends \
asciidoctor \
doxygen \
graphviz
- name: Install Antora
run: |
sudo npm i -g @antora/[email protected] @antora/[email protected];
- name: Show versions
run: |
make --version
echo -n "doxygen " ; doxygen --version
asciidoctor --version
echo -n "npm " ; npm --version
echo -n "node " ; node --version
antora --version
- name: Build doxygen content
run: |
cd doc/doxygen;
doxygen Doxyfile;
- name: Build Antora docsite
run: |
LATEST_RELEASE=$(git tag -l 'release_3_2*' | sort | tail -1 | sed -e 's/release_//' -e 's/_/\./g')
sed -e "s/%LATEST%/$LATEST_RELEASE/" doc/antora/main-site.yml.in > main-site.yml
antora --to-dir build/docsite main-site.yml
- name: Tar output files
run: tar -czf site.tgz doc/doxygen/html build/docsite
- name: Store output
uses: actions/upload-artifact@v4
with:
name: compiled-docs
path: site.tgz
retention-days: 1
# Actual deployment to GitHub Pages is only on pushes to the head of the master branch
deploy-doxygen-docs:
if: ( github.repository_owner == 'FreeRADIUS' ) && ( github.ref == 'refs/heads/master' ) && ( github.event_name == 'push' )
needs:
- build-docs
runs-on: ubuntu-latest
strategy:
fail-fast: true
# Permissions needed to deploy on GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Ensure only one job is attempting to update GitHub Pages
concurrency:
group: "documentation"
cancel-in-progress: true
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Retrieve output
uses: actions/download-artifact@v4
with:
name: compiled-docs
- name: Extract sites
run: tar -zxf site.tgz
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload Doxygen content
uses: actions/upload-pages-artifact@v3
with:
path: 'doc/doxygen/html'
- name: Deploy doxygen content to GitHub pages
id: deployment
uses: actions/deploy-pages@v4
deploy-antora-docs:
if: ( github.repository_owner == 'FreeRADIUS' ) && ( github.ref == 'refs/heads/master' ) && ( github.event_name == 'push' )
needs:
- build-docs
runs-on: ubuntu-latest
strategy:
fail-fast: true
# Ensure only one job is attempting to update the docs repo
concurrency:
group: "antora-documentation"
cancel-in-progress: true
steps:
- name: Setup SSH for git access
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.NR_GIT_SSH_GITHUBACTIONS_KEY }}
name: id_rsa-git
known_hosts: ${{ secrets.NR_GIT_SSH_KNOWN_HOSTS }}
config: |
Host git.networkradius.com
User git
IdentityFile ~/.ssh/id_rsa-git
- name: Retrieve output
uses: actions/download-artifact@v4
with:
name: compiled-docs
- name: Extract sites
run: tar -zxf site.tgz
- name: Checkout doc repository
run: |
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
git clone -b master [email protected]:www.freeradius.org-docs www.freeradius.org-docs
- name: Remove existing web site from repo
run: |
cd www.freeradius.org-docs
git ls-files -moc | grep -v ._antora_docs_repo | xargs -r git rm
- name: Copy new web site to repo
run: |
rsync -av build/docsite/ www.freeradius.org-docs/
- name: Commit new web site files
run: |
cd www.freeradius.org-docs
rm -f sitemap*.xml
git ls-files -o | xargs -r git add
git commit -q -m "Github Actions auto commit $(date)" || true
- name: Push doc repository
run: |
cd www.freeradius.org-docs
git push origin