-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (56 loc) · 2.14 KB
/
Copy pathsync-registry.yml
File metadata and controls
64 lines (56 loc) · 2.14 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
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
- name: Create PR with updated registry
if: steps.diff.outputs.changed == 'true'
run: |
BRANCH="auto/sync-registry-$(date +%s)"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "$BRANCH"
git add generated/
git commit -m "chore: sync registry from packages repository"
git push origin "$BRANCH"
gh pr create \
--title "chore: sync registry from packages" \
--body "Auto-generated from CardputerZero/packages update. Review and merge to publish." \
--base main \
--head "$BRANCH"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}