-
Notifications
You must be signed in to change notification settings - Fork 9
105 lines (88 loc) · 2.97 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
name: "📚 Documentation"
on:
push:
branches:
- master
paths:
- ".github/workflows/documentation.yml"
- "docs/*/**"
- "menu_from_project/**/*.py"
- "menu_from_project/metadata.txt"
- "requirements/documentation.txt"
tags:
- "*"
pull_request:
branches:
- master
paths:
- ".github/workflows/documentation.yml"
- docs/**/*
- requirements/documentation.txt
workflow_dispatch:
workflow_run:
workflows:
- "Packager 📦"
types:
- completed
# Allow one concurrent deployment per branch/pr
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
PROJECT_FOLDER: "menu_from_project"
PYTHON_VERSION: 3.9
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get source code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: "pip"
cache-dependency-path: "requirements/documentation.txt"
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -U -r requirements/documentation.txt
- name: Build doc using Sphinx
run: sphinx-build -b html -d docs/_build/cache -j auto docs docs/_build/html
- name: Save build doc as artifact
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs/_build/html/*
if-no-files-found: error
retention-days: 30
- name: Download artifact from build workflow
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')
uses: dawidd6/action-download-artifact@v6
with:
allow_forks: false
branch: master
event: push
github_token: ${{ secrets.GITHUB_TOKEN }}
if_no_artifact_found: warn
name: ${{ env.PROJECT_FOLDER }}-latest
path: docs/_build/html/
# run_id: ${{ github.event.workflow_run.id }}
workflow: package_and_release.yml
- name: Setup Pages
uses: actions/configure-pages@v5
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')
with:
path: docs/_build/html/
- name: Deploy to GitHub Pages
id: deployment
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')
uses: actions/deploy-pages@v4