-
Notifications
You must be signed in to change notification settings - Fork 7
102 lines (95 loc) · 3.06 KB
/
Copy pathpages.yaml
File metadata and controls
102 lines (95 loc) · 3.06 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: Deploy website
on:
workflow_run:
workflows:
- Test package and web app
types:
- completed
branches:
- master
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: github-pages
cancel-in-progress: true
jobs:
build:
if: >-
github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- name: Checkout tested source
uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.ref }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.14"
- name: Set up uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: "0.12.9"
- name: Build current wenxian wheel
run: uv build --wheel
- name: Assemble website and prebuilt Python environment
run: |
mkdir _site
cp -a docs/. _site/
wheel=$(echo dist/wenxian-*.whl)
python scripts/build_web_bundle.py \
"$wheel" _site/wenxian-web-packages.tar.gz
- name: Validate deployed bundle
run: |
test -f _site/index.html
test -f _site/webworker.js
test -f _site/wenxian-web-packages.tar.gz
bundle_bytes=$(stat -c%s _site/wenxian-web-packages.tar.gz)
echo "Web bundle: $bundle_bytes bytes"
test "$bundle_bytes" -lt 1000000
mkdir bundle-check
tar -xzf _site/wenxian-web-packages.tar.gz -C bundle-check
PYTHONPATH=bundle-check python - <<'PY'
import json
from importlib.metadata import version
from pathlib import Path
import pyiso4
import pylatexenc
import unidecode
import wenxian
manifest = json.loads(
Path("bundle-check/wenxian-web-manifest.json").read_text()
)
assert manifest["format"] == 1
assert manifest["packages"]["wenxian"] == version("wenxian")
assert manifest["requirements_lock"] == "web-requirements.lock"
assert "requests" not in {name.lower() for name in manifest["packages"]}
assert manifest["requirements"] == [
"pyiso4==0.1.6",
"pylatexenc==3.0a21",
"unidecode==1.4.0",
]
print(json.dumps(manifest, indent=2, sort_keys=True))
PY
- name: Upload website artifact
uses: actions/upload-pages-artifact@v5
with:
path: _site
deploy:
if: >-
github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'success'
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy website and Python bundle together
id: deployment
uses: actions/deploy-pages@v5