Repository navigation
67 lines (56 loc) · 2.28 KB
/
Copy pathdocs.yml
File metadata and controls
67 lines (56 loc) · 2.28 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
name: 'docs'
# Builds the documentation with warnings as errors, as Read the Docs does, and keeps the HTML
# as an artifact. Read the Docs publishes it, see .readthedocs.yaml: a push to main builds
# latest, and a release tag vX.Y.Z gets a version of its own and updates stable.
on:
push:
pull_request:
workflow_dispatch:
jobs:
docs:
runs-on: ubuntu-24.04
name: '📚 Sphinx'
steps:
- name: '🧰 Checkout'
uses: actions/checkout@v4
- name: '🐍 Setup Python'
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: '📚 Build'
run: |
pip install -r docs/requirements.txt
sphinx-build -W --keep-going -b html docs docs/_build/html
- name: '📤 Upload HTML'
uses: actions/upload-artifact@v4
with:
name: docs-html
path: docs/_build/html
publish:
needs: docs
if: >-
github.event_name == 'push' && github.repository == 'VUnit/vunit-python-bridge' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-24.04
name: '🚀 Read the Docs'
env:
API: https://app.readthedocs.org/api/v3/projects/vunit-python-bridge
AUTH: 'Authorization: Token ${{ secrets.READTHEDOCS_TOKEN }}'
steps:
- name: '🚀 Build latest'
if: github.ref == 'refs/heads/main'
run: curl --fail-with-body -X POST -H "$AUTH" "$API/versions/latest/builds/"
# Read the Docs learns about the tag in the background, so wait for its version
- name: '🚀 Build the release and stable'
if: startsWith(github.ref, 'refs/tags/v')
run: |
curl --fail-with-body -X POST -H "$AUTH" "$API/sync-versions/"
for attempt in $(seq 30); do
curl --fail -s -o /dev/null -H "$AUTH" "$API/versions/$GITHUB_REF_NAME/" && break
[ "$attempt" = 30 ] && { echo "::error::Read the Docs has no version $GITHUB_REF_NAME"; exit 1; }
sleep 10
done
curl --fail-with-body -X PATCH -H "$AUTH" -H 'Content-Type: application/json' \
-d '{"active": true, "hidden": false}' "$API/versions/$GITHUB_REF_NAME/"
curl --fail-with-body -X POST -H "$AUTH" "$API/versions/$GITHUB_REF_NAME/builds/"
curl --fail-with-body -X POST -H "$AUTH" "$API/versions/stable/builds/"