-
Notifications
You must be signed in to change notification settings - Fork 3
103 lines (86 loc) · 3.02 KB
/
docs.yml
File metadata and controls
103 lines (86 loc) · 3.02 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
name: Quarto Documentation
on:
push:
branches: [main]
tags: [v*]
workflow_dispatch:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
actions: write
contents: write # needed for gh-pages
jobs:
build-book:
name: Build and Deploy Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[dev]"
- name: Set PYTHONPATH
run: echo "PYTHONPATH=$GITHUB_WORKSPACE/src" >> $GITHUB_ENV
- name: Install Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Check Quarto installation
run: |
quarto check
- name: Render Quarto site
uses: quarto-dev/quarto-actions/render@v2
with:
to: html # If set, it will be equivalent to `quarto render --to html`
path: book
# Deploy Preview for PRs
- name: Publish PR Preview
if: github.event_name == 'pull_request'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/_book
destination_dir: previews/PR${{ github.event.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Deploy Dev Site from main
- name: Publish Dev Site
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/_book
destination_dir: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Deploy Versioned Release
- name: Publish Versioned Site
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/_book
destination_dir: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create 'latest' alias for stable release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, '-')
run: |
version="${GITHUB_REF#refs/tags/}"
echo "Detected version: $version"
mkdir -p ./latest
cp -r ./book/_book/* ./latest/
- name: Publish stable release to 'latest'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, '-')
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./latest
destination_dir: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}