generated from sensein/python-package-template
-
Notifications
You must be signed in to change notification settings - Fork 3
94 lines (90 loc) · 2.66 KB
/
docs.yaml
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
name: Build and Publish Docs
permissions:
contents: write
pages: write
id-token: write
on:
release:
types: [published]
jobs:
build-docs:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.10']
include:
- os: ubuntu-latest
python-version: '3.10'
deploy: true # Only deploy from this configuration
outputs:
deploy: ${{ steps.set-deploy-output.outputs.deploy }}
steps:
- uses: actions/checkout@v4
with: # no need for the history
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install ffmpeg (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get update && sudo apt-get install -y ffmpeg
- name: Install ffmpeg (macOS)
if: startsWith(matrix.os, 'macos')
run: brew install ffmpeg
- name: Install ffmpeg (Windows)
if: startsWith(matrix.os, 'windows')
run: choco install ffmpeg
- name: Install pipx and ensure it's up to date
run: |
python -m pip install --upgrade pipx
pipx ensurepath
shell: bash
- name: Install poetry
run: pipx install poetry
shell: bash
- name: Install dependencies with Poetry
run: |
poetry install --with dev,docs
shell: bash
- name: Build docs
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
APP_MODULE_NAME=$(ls -1 src | sort | head -1)
echo "APP_MODULE_NAME: $APP_MODULE_NAME"
poetry run pdoc src/"$APP_MODULE_NAME" -o docs -t docs_style/pdoc-theme --docformat google --favicon https://readthedocs.org/favicon.ico
touch docs/.nojekyll
shell: bash
- name: Determine if deployment is needed
id: set-deploy-output
run: echo "::set-output name=deploy::true"
shell: bash
- uses: actions/upload-artifact@v4
with:
name: documentation
path: docs
publish-docs:
needs: build-docs
if: ${{ needs.build-docs.outputs.deploy == 'true' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] # For demonstration, other OSes are commented out
python-version: ['3.10']
include:
- os: ubuntu-latest
python-version: '3.10'
deploy: true # Only deploy from this configuration
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: documentation
path: docs
- uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs
branch: docs