-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathaction.yml
More file actions
114 lines (97 loc) · 3.29 KB
/
action.yml
File metadata and controls
114 lines (97 loc) · 3.29 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
106
107
108
109
110
111
112
113
114
name: Build mkdocs
description: Parametrized mkdocs building
inputs:
github_token:
description: github token
required: true
site_url:
description: Set `MKDOCS_SITE_URL` env var
default: ""
required: true
working_dir:
description: Parent directory that contains mkdocs.yml
default: ${{ github.workspace }}/docs
output_dir:
description: Where we will output the resulting webpage
default: ${{ github.workspace }}/book
upload_github_page:
description: Upload github-page
default: "false"
repo_url:
description: URL of the repo
default: ${{ github.server_url }}/${{ github.repository }}
outputs:
artifact_id:
description: "Artifact id uploaded (is an empty string in case of `upload_github_page: false`)"
value: ${{ steps.upload-artifact.outputs.artifact_id }}
runs:
using: composite
steps:
- name: Install uv
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Configure uv
working-directory: ${{ inputs.working_dir }}
shell: bash
run: uv python install
- name: uv install deps
id: uv-setup
shell: bash
working-directory: ${{ inputs.working_dir }}
run: uv sync --all-extras --dev
continue-on-error: true
# Fallback for whenever 'watchdog' dep gives issues
# FIXME: Remove me whenever 'watchdog' doesnt give issues anymore
- name: uv install deps
shell: bash
if: ${{ steps.uv-setup.outcome == 'failure' }}
working-directory: ${{ inputs.working_dir }}
run: uv sync --all-extras --dev --no-binary-package=watchdog
- name: Build book
shell: bash
working-directory: ${{ inputs.working_dir }}
env:
MKDOCS_SITE_URL: ${{ inputs.site_url }}
MKDOCS_REPO_URL: ${{ inputs.repo_url }}
_OUTPUT_DIR: ${{ inputs.output_dir }}
run: |
source .venv/bin/activate
set -euo pipefail
mkdocs build -d $_OUTPUT_DIR
- name: Restore lychee cache
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- name: Check links
uses: lycheeverse/lychee-action@v2.7.0
with:
args: >-
--root-dir ${{ inputs.output_dir }}
--exclude 'https://github.com/[^/]+/docs.bazzite.gg/(raw|blob)/[^/]+/src/'
${{ inputs.output_dir }}
jobSummary: true
fail: false
token: ${{ inputs.github_token }}
- name: Setup Pages
if: ${{ inputs.upload_github_page == 'true' }}
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
with:
token: ${{ inputs.github_token }}
- name: Upload artifact
if: ${{ inputs.upload_github_page == 'true' }}
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4
id: upload-artifact
with:
path: ${{ inputs.output_dir }}
token: ${{ inputs.github_token }}
retention-days: 3
- name: Deploy to GitHub Pages
if: ${{ inputs.upload_github_page == 'true' }}
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
with:
token: ${{ inputs.github_token }}