-
Notifications
You must be signed in to change notification settings - Fork 72
105 lines (92 loc) · 2.91 KB
/
Copy pathbuild_docs.yml
File metadata and controls
105 lines (92 loc) · 2.91 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
---
name: Build Docs
on: # yamllint disable-line rule:truthy
push:
branches: [main]
tags:
- "v*"
pull_request:
branches:
- "*"
workflow_dispatch:
inputs:
version:
description: Manual Doc Build
default: run-doc-build
required: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
docs:
name: Build & push docs
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
matrix:
os: ["ubuntu-latest"]
environment-file: [docs/environment.yaml]
experimental: [false]
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout repo
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup micromamba
uses: mamba-org/setup-micromamba@v3
with:
environment-file: ${{ matrix.environment-file }}
micromamba-version: "latest"
- name: Install package
run: pip install . --no-deps
- name: Make docs
run: cd docs; make html
- name: Zip documentation
if: ${{ github.event_name == 'pull_request' }}
run: zip docs_artifact.zip docs/build/html -r
- name: Upload artifact
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v7
with:
name: docs_artifact
path: docs_artifact.zip
- name: Publish to Github Pages on main (dev)
if: ${{ github.ref == 'refs/heads/main' }}
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html/
destination_dir: dev
keep_files: false
- name: Publish to Github Pages on release (versioned)
if: ${{ github.ref_type == 'tag' }}
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html/
destination_dir: ${{ github.ref_name }}
- name: Publish to Github Pages on release (stable)
if: ${{ github.ref_type == 'tag' }}
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html/
destination_dir: stable
keep_files: false
- name: Update the versions switcher
if: ${{ github.ref_type == 'tag' }}
run: | # yamllint disable-line rule:line-length
git checkout gh-pages
git fetch
git pull
git config --global user.name 'github-actions[bot]'
git config --global user.email \
'41898282+github-actions[bot]@users.noreply.github.com'
python update_version_json.py --version ${{ github.ref_name }}
git add versions.json
git commit -m "Update versions switcher"
git push
git checkout main