Repository navigation
111 lines (102 loc) · 5.13 KB
/
Copy pathgithub-pages.yml
File metadata and controls
111 lines (102 loc) · 5.13 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
name: github-pages
on:
workflow_dispatch:
push:
branches: [main]
paths:
- "docs/**"
- ".github/workflows/github-pages.yml"
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 30
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v7
- id: pages
uses: actions/configure-pages@v6
with:
enablement: true
- name: Install Pandoc
if: steps.pages.outcome == 'success'
run: sudo apt-get update && sudo apt-get install -y pandoc
- name: Stage docs site
if: steps.pages.outcome == 'success'
shell: bash
run: |
set -euo pipefail
rm -rf site-root
mkdir -p site-root/docs
# 1. The hand-built HTML shell: landing page, documentation hub, FAQ,
# shared stylesheet, .nojekyll, and the update feed.
cp -R docs/site/. site-root/
# 2. Every documentation page already rendered to HTML under docs/.
# The site serves HTML only — no Markdown is published. Files
# nested under docs/<subdir>/ are flattened into site-root/docs/
# so the site can link to them by bare filename (e.g.
# /docs/userguide.html serves docs/user guide/userguide.html).
# docs/site/ is excluded because the hand-built site shell is
# already copied wholesale above.
find docs -name '*.html' \
-not -path 'docs/site/*' \
-not -name 'index.html' \
-exec cp {} site-root/docs/ \;
# 2b. QUILL's user guide is a contents page plus a folder of chapters
# (quill/core/user_guide_files.py): userguide.html links them as
# quill-guide/<chapter>.html, and the WordPress and Forms chapters
# link ../wordpress-and-forms/. So the pages in folders under
# docs/user guide/ are also published in those same folders, and
# those relative links work on the site as they do in the tree.
find "docs/user guide" -mindepth 2 -name '*.html' -print0 |
while IFS= read -r -d '' page; do
rel="${page#docs/user guide/}"
mkdir -p "site-root/docs/$(dirname "$rel")"
cp "$page" "site-root/docs/$rel"
done
# 3. Render the project's top-level contributor/governance docs to
# HTML so the site is self-contained (no links off to raw Markdown).
# Uses the same accessible template and +smart reader as
# scripts/release_readiness.py, so pages published from here carry
# <html lang>, a skip link and a <main> landmark like every other
# rendered doc. Without the template these served straight to the
# public site with no language and no landmarks at all.
template=docs/pandoc/quill-accessible.html5
test -f "$template" || { echo "Missing accessible pandoc template: $template" >&2; exit 1; }
render_root() { [ -f "$1" ] && pandoc "$1" -f gfm+smart -t html5 -s --template "$template" --metadata pagetitle="$3" --metadata title="$3" -o "site-root/docs/$2" || true; }
render_root docs/CONTRIBUTING.md contributing.html "Contributing to QUILL"
render_root docs/GOVERNANCE.md governance.html "QUILL Governance"
render_root docs/CODE_OF_CONDUCT.md code-of-conduct.html "Code of Conduct"
render_root docs/MAINTAINERS.md maintainers.html "QUILL Maintainers"
render_root docs/SECURITY.md security.html "Security Policy"
render_root docs/legal/PRIVACY.md privacy.html "Privacy"
render_root docs/legal/RESPONSIBLE_AI_USE.md responsible-ai-use.html "Responsible AI Use"
# 4. Rewrite internal Markdown links to their published HTML targets so
# no served page points at a .md file. Order matters: handle the
# docs/-prefixed and ../ cases before the bare same-directory case.
find site-root/docs -name '*.html' -print0 | xargs -0 sed -i \
-e 's@href="docs/\([^"#]*\)\.md\(#[^"]*\)\?"@href="\1.html\2"@g' \
-e 's@href="\.\./CODE_OF_CONDUCT\.md"@href="code-of-conduct.html"@g' \
-e 's@href="\.\./SECURITY\.md"@href="security.html"@g' \
-e 's@href="\.\./CONTRIBUTING\.md"@href="contributing.html"@g' \
-e 's@href="\([^"#:]*\)\.md\(#[^"]*\)\?"@href="\1.html\2"@g'
- name: Skip Pages deploy (not enabled)
if: steps.pages.outcome != 'success'
shell: bash
run: |
echo "GitHub Pages is not enabled or accessible for this repository/token. Skipping deploy without failing CI."
- uses: actions/upload-pages-artifact@v5
if: steps.pages.outcome == 'success'
with:
path: site-root
- id: deployment
uses: actions/deploy-pages@v5
if: steps.pages.outcome == 'success'