-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (83 loc) · 2.91 KB
/
Copy pathpages.yml
File metadata and controls
83 lines (83 loc) · 2.91 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
name: Deploy Pages
on:
push:
branches:
- main
- master
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
permissions:
contents: read
# Single owner of the GitHub Pages deployment. Both the documentation site and
# the schema registry are built into one artifact so a docs push and a schema
# tag can never clobber each other on the single Pages origin.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: 3.x
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22
cache: npm
# Build the documentation site first. mkdocs cleans its output directory,
# so the registry must be assembled into ./site afterwards.
- run: pip install mkdocs-material
- run: mkdocs build
- run: npm ci
- run: npm test
- name: Build every released schema version into ./site/registry
shell: bash
run: |
set -euo pipefail
rm -rf registry release-source
tags="$(git tag --list "v[0-9]*.[0-9]*.[0-9]*" --sort=version:refname)"
if [[ -z "$tags" ]]; then
echo "No release tags found; deploying documentation without a schema registry."
exit 0
fi
while IFS= read -r tag; do
version="${tag#v}"
line="v${version%.*}"
mkdir -p "release-source/$version"
git archive "$tag" "schemas/$line" | tar -x -C "release-source/$version"
node scripts/build-registry.mjs \
--version "$version" \
--source "release-source/$version/schemas/$line" \
--output registry \
--append
done <<< "$tags"
npm run validate:registry -- --registry registry
# The registry is served as a sub-path of the single Pages site, so it
# must not carry its own CNAME (that would remap the whole origin).
rm -f registry/CNAME
mkdir -p site/registry
cp -R registry/. site/registry/
- uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: ./site
deploy:
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
timeout-minutes: 10
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0