-
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (97 loc) · 2.92 KB
/
docs.yml
File metadata and controls
102 lines (97 loc) · 2.92 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
name: Docs
on:
push:
branches: [main]
paths:
- "**/*.py"
- "!cookiecutter/**"
- "src/sphinx_social_cards/**/*.yml"
- "docs/**"
- ".pre-commit-config.yaml"
- "uv.lock"
- "pyproject.toml"
- ".github/workflows/docs.yml"
pull_request:
branches: [main]
paths:
- "**/*.py"
- "!cookiecutter/**"
- "src/sphinx_social_cards/**/*.yml"
- "docs/**"
- ".pre-commit-config.yaml"
- "uv.lock"
- "pyproject.toml"
- ".github/workflows/docs.yml"
workflow_dispatch:
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
permissions:
contents: read
env:
SPHINX_IMMATERIAL_EXTERNAL_RESOURCE_CACHE_DIR: ${{ github.workspace }}/docs_theme_build_cache
steps:
- if: runner.os == 'Linux'
run: |-
sudo apt-get update
sudo apt-get install -y libgl-dev libglvnd-dev libxkbcommon-x11-0
echo "QT_QPA_PLATFORM=offscreen" >> "${GITHUB_ENV}"
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@v6
id: python-setup
with:
python-version: "3.x"
- name: Setup uv
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
with:
python-version: ${{ steps.python-setup.outputs.python-version }}
enable-cache: true
- name: Restore cache of sphinx-immaterial fonts
uses: actions/cache/restore@v5
id: restore-cache
with:
path: ${{ env.SPHINX_IMMATERIAL_EXTERNAL_RESOURCE_CACHE_DIR }}
key: ${{ matrix.os }}-docs-cache-${{ github.run_id }}
- name: Build docs
run: uvx nox -s docs
env:
GITHUB_REST_API_TOKEN: ${{ github.token }}
FORCE_COLOR: 1
- name: Upload docs artifact
if: runner.os == 'Linux'
uses: actions/upload-pages-artifact@v4
with:
path: docs/_build/html
- name: Cache sphinx-immaterial fonts
if: always() && steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: ${{ env.SPHINX_IMMATERIAL_EXTERNAL_RESOURCE_CACHE_DIR }}
key: ${{ matrix.os }}-docs-cache-${{ github.run_id }}
deploy:
if: github.ref == 'refs/heads/main'
needs: [build]
runs-on: ubuntu-latest
permissions:
# to deploy to Pages
pages: write
# to verify the deployment originates from an appropriate source
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
id: deployment