-
Notifications
You must be signed in to change notification settings - Fork 3
138 lines (114 loc) · 3.54 KB
/
website.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: website
on:
push:
branches: [main]
pull_request:
release:
types: [published]
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
render-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: quarto-dev/quarto-actions/setup@v2
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: install poetry
run: pip install poetry
- name: install package
run: poetry install --with docs
# This section renders the quarto documents (and the README file)
# and moves them to the docs/source/_compiled_qmd directory
# which is then uploaded as an artifact.
- name: Render documents
run: |
cd docs/source/tutorials
poetry run make tutorials_clean
poetry run make tutorials_rst
# Upload
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: tutorials
path: docs/source/tutorials
build:
needs: render-docs
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
page_artifact_id: ${{ steps.upload.outputs.artifact_id }}
steps:
- uses: actions/checkout@v4
- uses: quarto-dev/quarto-actions/setup@v2
# Setting up the environment
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Poetry
run: pip install poetry
- name: Install dependencies with Poetry
run: poetry install --with docs
- name: Render documentation index from README
run: |
poetry run quarto render README.md --to rst -o index.rst
mv index.rst docs/source
poetry run python docs/post_process_rst.py docs/source/index.rst
# Download the rendered tutorials
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: tutorials
path: docs/source/tutorials/
# Building
- name: Build HTML using Poetry
run: poetry run sphinx-build -M html docs/source/ docs/build/
# Upload
- name: Upload artifacts
uses: actions/upload-pages-artifact@v3
id: upload
with:
name: github-pages
path: docs/build/html/
deploy:
# Deploy to the github-pages environment
# but not on PRs
if: ${{ github.event_name != 'pull_request' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: github-pages
preview: true
post-page-artifact:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Post comment preview
if: ${{ github.event_name == 'pull_request' }}
run: |
gh pr comment ${{ github.event.number }} --body \
"Thank you for your contribution @${{ github.triggering_actor }}:rocket:! Your page is ready to preview :point_right: [here](https://github.com/${{github.repository}}/actions/runs/${{ github.run_id }}/artifacts/${{ needs.build.outputs.page_artifact_id }}) :point_left:!"