-
-
Notifications
You must be signed in to change notification settings - Fork 10
45 lines (40 loc) · 1.56 KB
/
Register.yml
File metadata and controls
45 lines (40 loc) · 1.56 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
name: Build Registry
on:
release:
types: [ published ] # fires when you publish or re-publish a GitHub Release
jobs:
generate:
runs-on: ubuntu-latest
permissions:
contents: read
pages: write # to upload artefacts for the Pages site
id-token: write
steps:
- uses: actions/checkout@v4
- name: 🔽 Download wheels attached to this Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG=${{ github.event.release.tag_name }}
mkdir -p registry/wheels
gh release download "$TAG" --pattern '*.whl' -D registry/wheels
- name: 🏗 Build index.json
run: |
python <<'PY'
import json, hashlib, pathlib, urllib.parse, os
root = pathlib.Path("registry")
wheels_path = root / "wheels"
index = {}
base_url = "https://drQedwards.github.io/PPM/wheels/"
for wheel in wheels_path.glob("*.whl"):
# Extract "package-version-*.whl"
name, version, *_ = wheel.stem.split("-")
sha256 = hashlib.sha256(wheel.read_bytes()).hexdigest()
url = urllib.parse.urljoin(base_url, wheel.name)
index.setdefault(name, {})[version] = {"url": url, "sha256": sha256}
(root / "index.json").write_text(json.dumps(index, indent=2))
PY
- name: ⬆️ Upload registry artefacts for Pages deployment
uses: actions/upload-pages-artifact@v3
with:
path: registry # merged into /registry on next Pages deploy