-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (52 loc) · 2.08 KB
/
Copy pathsync-registry.yml
File metadata and controls
60 lines (52 loc) · 2.08 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
name: Sync Registry from Packages
on:
repository_dispatch:
types: [packages-updated]
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch Packages index and meta.json files
run: |
# Download APT Packages index
curl -fsSL "https://cardputerzero.github.io/packages/dists/stable/main/binary-arm64/Packages" -o /tmp/Packages
# Download all meta.json files by parsing package names from index
mkdir -p /tmp/meta
grep '^Package: ' /tmp/Packages | awk '{print $2}' | sort -u | while read pkg; do
url="https://raw.githubusercontent.com/CardputerZero/packages/main/pool/main/${pkg}/meta.json"
curl -fsSL "$url" -o "/tmp/meta/${pkg}.json" 2>/dev/null || true
done
- 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