-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreusable-build-docs-with-python.yml
More file actions
79 lines (68 loc) · 2.7 KB
/
reusable-build-docs-with-python.yml
File metadata and controls
79 lines (68 loc) · 2.7 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
name: Build website
on:
workflow_call:
inputs:
hosting-provider:
description: "Hosting provider to use for publishing the website: netlify or gh-pages. If 'gh-pages', also need to set permissions."
required: false
type: string
default: 'netlify'
secrets:
netlify-token:
required: false
github-token:
# Needs permissions: contents: write, pages: write
required: false
jobs:
build-website:
runs-on: ubuntu-latest
concurrency:
group: build-website-python-group
cancel-in-progress: true
env:
QUARTO_PYTHON: ".venv/bin/python3"
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Check out repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
with:
# Install a specific version of uv.
# uv recommends to set the version for best practice.
version: "0.6.13"
# To have a faster CI time, enable cache between runs.
enable-cache: true
# Reset the cache if the lock file changes.
cache-dependency-glob: "uv.lock"
- name: "Set up Python"
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version-file: "pyproject.toml"
- name: Install the project and it's dependencies
run: |
uv sync --all-extras --dev
source .venv/bin/activate
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@8a96df13519ee81fd526f2dfca5962811136661b # v2.2.0
- name: Spell check repo
uses: crate-ci/typos@5c19779cb52ea50e151f5a10333ccd269227b5ae # v1.41.0
- name: Build function reference docs
run: uv run quartodoc build
- name: Publish to Netlify (and render)
if: ${{ inputs.hosting-provider == 'netlify' }}
uses: quarto-dev/quarto-actions/publish@8a96df13519ee81fd526f2dfca5962811136661b # v2.2.0
with:
target: netlify
NETLIFY_AUTH_TOKEN: ${{ secrets.netlify-token }}
# NOTE: If Publishing to GitHub Pages, set the permissions correctly (see above).
- name: Publish to GitHub Pages (and render)
if: ${{ inputs.hosting-provider == 'gh-pages' }}
uses: quarto-dev/quarto-actions/publish@8a96df13519ee81fd526f2dfca5962811136661b # v2.2.0
with:
target: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.github-token }}