Skip to content

packages-updated

packages-updated #17

Workflow file for this run

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 }}