-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (100 loc) · 3.28 KB
/
documentation.yml
File metadata and controls
119 lines (100 loc) · 3.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
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
name: "📚 Documentation"
# Global environment variables
env:
CONDITION_IS_PUSH: ${{ github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') }}
CONDITION_IS_WORKFLOW_RUN: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' }}
PROJECT_FOLDER: plugin_map2loop
PYTHON_VERSION: 3.12
# This workflow is triggered on:
on:
push:
branches:
- main
paths:
- '.github/workflows/documentation.yml'
- 'docs/**/*'
- "plugin_map2loop/**/*.py"
- "plugin_map2loop/metadata.txt"
- 'requirements/documentation.txt'
tags:
- "*"
pull_request:
branches:
- main
paths:
- ".github/workflows/documentation.yml"
- docs/**/*
- requirements/documentation.txt
workflow_dispatch:
workflow_run:
workflows:
- "📦 Package & 🚀 Release"
types:
- completed
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
id-token: write
pages: write
# Allow one concurrent deployment per branch/pr
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get source code
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: "pip"
cache-dependency-path: "requirements/documentation.txt"
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache Sphinx cache
uses: actions/cache@v4
with:
path: docs/_build/cache
key: ${{ runner.os }}-sphinx-${{ hashFiles('docs/**/*') }}
restore-keys: |
${{ runner.os }}-sphinx-
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/documentation.txt
- name: Build doc using Sphinx
run: sphinx-build -b html -j auto -d docs/_build/cache -q docs docs/_build/html
- name: Download artifact from build workflow
if: ${{ env.CONDITION_IS_PUSH || env.CONDITION_IS_WORKFLOW_RUN }}
uses: dawidd6/action-download-artifact@v11
with:
allow_forks: false
branch: main
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: Save build doc as artifact
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: documentation
path: docs/_build/html/*
retention-days: 30
- name: Setup Pages
uses: actions/configure-pages@v5
if: ${{ env.CONDITION_IS_PUSH || env.CONDITION_IS_WORKFLOW_RUN }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
if: ${{ env.CONDITION_IS_PUSH || env.CONDITION_IS_WORKFLOW_RUN }}
with:
# Upload entire repository
path: docs/_build/html/
- name: Deploy to GitHub Pages
id: deployment
if: ${{ env.CONDITION_IS_PUSH || env.CONDITION_IS_WORKFLOW_RUN }}
uses: actions/deploy-pages@v4