Repository navigation
74 lines (65 loc) · 2.39 KB
/
Copy pathsync-registry.yml
File metadata and controls
74 lines (65 loc) · 2.39 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
name: Sync Registry from Packages
on:
repository_dispatch:
types: [packages-updated]
workflow_dispatch:
concurrency:
group: sync-store-registry
cancel-in-progress: false
jobs:
sync:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Bootstrap first publication dates from the committed registry history.
fetch-depth: 0
- name: Checkout the exact package publication snapshot
uses: actions/checkout@v4
with:
repository: CardputerZero/packages
ref: ${{ github.event.client_payload.packages_sha || 'main' }}
path: packages-source
persist-credentials: false
sparse-checkout: pool/main
- name: Fetch and verify Packages against the source snapshot
env:
EXPECTED_INDEX_SHA256: ${{ github.event.client_payload.index_sha256 || '' }}
run: |
python3 scripts/prepare_registry_inputs.py \
--pool packages-source/pool/main \
--packages /tmp/Packages \
--meta-dir /tmp/meta \
--expected-sha256 "$EXPECTED_INDEX_SHA256"
- name: Generate registry JSON
run: |
python3 scripts/generate_registry.py \
--packages /tmp/Packages \
--meta-dir /tmp/meta \
--overrides registry-overrides.json \
--out generated
- name: Check for changes
id: diff
run: |
if git diff --quiet generated/; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
# The registry is derived data: packages already went through human
# review in CardputerZero/packages (publish PR), so the sync commits
# straight to main — a second review gate here only let the store lag.
- name: Commit updated registry to main
if: steps.diff.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add generated/
git commit -m "chore: sync registry from packages repository"
# Rebase in case another run landed between checkout and push.
git pull --rebase origin main
git push origin main