diff --git a/.github/workflows/generate-keyring-data.yaml b/.github/workflows/generate-keyring-data.yaml new file mode 100644 index 00000000..26873ee6 --- /dev/null +++ b/.github/workflows/generate-keyring-data.yaml @@ -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" diff --git a/.github/workflows/generate-motd.yaml b/.github/workflows/generate-motd.yaml index dcbc98fc..3d01208e 100644 --- a/.github/workflows/generate-motd.yaml +++ b/.github/workflows/generate-motd.yaml @@ -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"