-
Notifications
You must be signed in to change notification settings - Fork 4
73 lines (62 loc) · 1.76 KB
/
Copy pathdocs.yaml
File metadata and controls
73 lines (62 loc) · 1.76 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
---
name: Publish API documentation to GitHub Pages
on:
push:
branches:
- main
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy-docs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Install dependencies
run: pip install .
- name: Install pdoc
run: pip install pdoc
- name: Get version
id: get_version
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
VERSION_RAW="${{ github.event.release.tag_name }}"
echo "VERSION=${VERSION_RAW#v}" >> $GITHUB_ENV
else
echo "VERSION=dev" >> $GITHUB_ENV
fi
- name: Build docs
env:
VERSION: ${{ env.VERSION }}
run: |
pdoc src/spdx_python_model -o docs
# Copy files to versioned/dev directory
mkdir -p "pages/${{ env.VERSION }}"
cp -r docs/* "pages/${{ env.VERSION }}/"
# Create an index.html to redirect to the dev docs
if [[ "${{ env.VERSION }}" == "dev" ]]; then
echo '<meta http-equiv="refresh" content="0; url=dev/" />' > pages/index.html
fi
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4