Repository navigation
112 lines (99 loc) · 4.49 KB
/
Copy pathaggregate.yml
File metadata and controls
112 lines (99 loc) · 4.49 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
name: Aggregate registry
# Ingests the author manifests into registry.db (the durable source of truth — a failed author
# fetch keeps that plugin's last-known-good rows) and exports the static catalog the Fizzy app
# fetches (plugins/catalog/summary.json + one plugins/catalog/<abi_fingerprint>/releases.json
# shard per SDK generation), then publishes plugins/ to GitHub Pages. See store/ for the tool.
# Triggers: a registry/store change (reviewed PR merge), a periodic refresh so author manifest
# updates land without a commit here, and manual runs. The path filter excludes plugins/** and
# registry.db so the commit-back below never re-triggers the workflow.
#
# **A run that commits a new catalog does not deploy it; it starts this workflow again on the
# commit it made, which does.** Pages names a deployment after the run's commit (GITHUB_SHA) and
# keeps the first deployment of a name: a second deploy of the same name reports success and is
# never served. A scheduled run starts on main's head, and when it then commits a refreshed
# catalog, deploying from that run reuses the head's name, already deployed. So every refresh
# that found a new plugin release published nothing (2026-10-14: four deployments under
# `0f57c7e`, the site serving the first, a day old). The commit-back is pushed with this
# workflow's token, which starts no workflow, so the run asks for its successor itself.
on:
push:
branches: [main]
paths:
- "registry/**"
- "store/**"
- ".github/workflows/aggregate.yml"
schedule:
- cron: "17 */6 * * *" # every 6 hours
workflow_dispatch:
# Allow committing the regenerated db + catalog and deploying Pages.
permissions:
contents: write
pages: write
id-token: write
# To start this workflow again on the commit a refresh makes (see the top).
actions: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
outputs:
committed: ${{ steps.commit.outputs.committed }}
env:
# Pinned so the workaround below targets a known path. Works around a Zig 0.16.0 bug where
# `zig fetch` fails on zip dependencies (e.g. zig-sqlite's sqlite-amalgamation-*.zip) with
# "failed to create temporary zip file: FileNotFound" when the global cache's tmp/ dir
# doesn't exist yet (fresh runner). See https://codeberg.org/ziglang/zig/issues/35264.
ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}/.zig-global-cache
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2
with:
version: "0.16.0"
- name: Work around zig fetch zip bug (codeberg.org/ziglang/zig#35264)
run: mkdir -p "$ZIG_GLOBAL_CACHE_DIR/tmp"
- name: Build the store tool
working-directory: store
run: zig build -Doptimize=ReleaseSafe
- name: Ingest author manifests into registry.db
working-directory: store
run: ./zig-out/bin/store ingest --root .. --db ../registry.db
- name: Export the catalog (summary + per-fingerprint shards)
working-directory: store
run: ./zig-out/bin/store export --db ../registry.db --out ../plugins/catalog
- name: Commit registry.db + catalog if changed
id: commit
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add registry.db plugins/catalog
if ! git diff --quiet --cached; then
git commit -m "chore: refresh registry.db + plugins/catalog"
git push
echo "committed=true" >> "$GITHUB_OUTPUT"
else
echo "registry.db and catalog unchanged"
fi
# Deployed from here only when this run's commit is the catalog's; otherwise its successor,
# started on the new commit, deploys it (see the top).
- name: Upload Pages artifact (the plugins/ directory)
if: steps.commit.outputs.committed != 'true'
uses: actions/upload-pages-artifact@v3
with:
path: plugins
- name: Deploy the refreshed catalog from its own commit
if: steps.commit.outputs.committed == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: gh workflow run aggregate.yml --repo "$GITHUB_REPOSITORY" --ref main
deploy:
needs: build
if: needs.build.outputs.committed != 'true'
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4