cache the latest keyring versions for mmdebstrap

This commit is contained in:
tabris
2025-11-03 16:54:14 -05:00
committed by Igor
parent 37d83ab887
commit d052d5f45b
2 changed files with 55 additions and 1 deletions

View File

@@ -0,0 +1,54 @@
name: "Generate list of latest keyrings for Debian & Ubuntu"
on:
schedule: [ { cron: '0 0 * * 0' } ]
workflow_dispatch:
concurrency:
group: redirector
cancel-in-progress: false
jobs:
generate-keyring-data:
runs-on: ubuntu-24.04
name: "Generate Keyring Data"
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
path: armbian.github.io
- name: "Generate keyring files"
run: |
NEWEST_SUITE=$(curl --max-time=30 --compressed -fLs https://changelogs.ubuntu.com/meta-release | grep '^Dist:'| tail -n 1 | awk '{print $NF}')
# NOTE: this service on PUC returns a long list of ISO-3166-2 country code prefixed archive.ubuntu.com mirrors [among others]
# We remove that prefix as it's better to use the rotation. the number in the regex is b/c nz has nz and nz2
# example URL returned: http://nz2.archive.ubuntu.com/ubuntu/pool/main/u/ubuntu-keyring/ubuntu-keyring_2023.11.28.1_all.deb
PKG_URL=$(curl --max-time=30 --compressed -fLs "https://packages.ubuntu.com/${NEWEST_SUITE}/all/ubuntu-keyring/download" | \
grep -oP 'https?://\S+archive.ubuntu.com/ubuntu/pool/main/u/\S+\.deb' | tail -n 1 | sed -E 's#://[a-z][a-z][0-9]?\.#://#')
[[ -z "${PKG_URL}" ]] && (echo "fetch_newest_keyring failed - unable to find newest ubuntu-keyring package"; exit 1)
echo $PKG_URL > latest-ubuntu-keyring.txt
for p in debian-archive-keyring debian-ports-archive-keyring; do
PKG_URL=$(curl --max-time=30 --compressed -fLs "https://packages.debian.org/sid/all/${p}/download" | \
grep -oP "https?://(deb|ftp)\.debian\.org/debian/pool/main/d/${p}/${p}_\S+\.deb")
[[ -z "${PKG_URL}" ]] && (echo "fetch_newest_keyring failed - unable to find newest $p package"; exit 1)
echo $PKG_URL > latest-$p.txt
done
- name: Commit changes if any
run: |
cd armbian.github.io
git checkout data
mkdir -p data/
mv ${{ github.workspace }}/latest-*keyring*.txt data/
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git add data/.
git diff --cached --quiet || git commit -m "Update keyring data files"
git push
- name: "Run Bigin update action"
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
event-type: "Bigin update"

View File

@@ -42,7 +42,7 @@ jobs:
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git add data/.
git diff --cached --quiet || git commit -m "Update WEB indes files"
git diff --cached --quiet || git commit -m "Update WEB index files"
git push
- name: "Run Bigin update action"