-
Notifications
You must be signed in to change notification settings - Fork 14
98 lines (91 loc) · 3.92 KB
/
documentation.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
95
96
97
98
name: pypop.org website and docs generation
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
paths:
- '*.rst'
- 'NEWS.md'
- 'LICENSE'
- 'website/**'
- 'tests/data/doc-examples/**'
- 'src/PyPop/CommandLineInterface.py'
- '.github/workflows/documentation.yaml'
- '!website/README.md'
- '!website/reference/**'
pull_request:
paths:
- '*.rst'
- 'NEWS.md'
- 'LICENSE'
- 'website/**'
- 'tests/data/doc-examples/**'
- 'src/PyPop/CommandLineInterface.py'
- '.github/workflows/documentation.yaml'
- '!website/README.md'
- '!website/reference/**'
release:
types:
- published
permissions:
contents: write
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check GitHub Action permissions
run: |
echo "github.actor: ${{ toJson(github.actor) }}"
echo "github.triggering_actor: ${{ toJson(github.triggering_actor) }}"
echo "github.repository_owner: ${{ toJson(github.repository_owner) }}"
echo "github.repository_owner: ${{ toJson(github.repository_owner) }}"
echo "github.repository: ${{ toJson(github.repository) }}"
echo "github.event.pull_request.base.repo.full_name: ${{ toJson(github.event.pull_request.base.repo.full_name) }}"
echo "github.event.pull_request.head.repo.full_name: ${{ toJson(github.event.pull_request.head.repo.full_name) }}"
echo "github.ref: ${{ toJson(github.ref) }}"
echo "github.event_name: ${{ toJson(github.event_name) }}"
echo "github.event.action: ${{ toJson(github.event.action) }}"
echo "github.event.release.target_commitish: ${{ toJson(github.event.release.target_commitish) }}"
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
pip install setuptools_scm sphinx==8.0.2 piccolo-theme myst_parser rst2pdf sphinx_togglebutton sphinx-argparse sphinx_copybutton sphinxcontrib-bibtex
sudo apt clean
sudo apt-get update
sudo apt-get install --fix-missing -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended texlive-fonts-extra texlive-luatex texlive-xetex
- name: Sphinx build
run: |
# latex build in separate directory
# it generates a lot of files we don't need to keep
sphinx-build -b latex website _latexbuild
make -C _latexbuild
# create _build directory and move the PDF there
mkdir _build
cp _latexbuild/*.pdf _build/
# now build the HTML
sphinx-build website _build
- name: Deploy to beta site
uses: peaceiris/actions-gh-pages@v4
# only update beta site if base and head branches match, not for forks
# forks cannot access secrets to deploy, see: https://github.com/orgs/community/discussions/26829
if: ${{ (github.event.pull_request.base.repo.full_name == github.event.pull_request.head.repo.full_name) }}
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: alexlancaster/beta.pypop.org
publish_branch: gh-pages # default: gh-pages
publish_dir: _build/
force_orphan: true
- name: Deploy to production
uses: peaceiris/actions-gh-pages@v4
# only update on either a push on main, or published release on the main
if: ${{ (github.ref == 'refs/heads/main' && github.event_name == 'push') || (github.event.release.target_commitish == 'main' && github.event_name == 'release' && github.event.action == 'published') }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/
force_orphan: true