From db74a6b65aeab543ad18ff53ecccc02c148c0462 Mon Sep 17 00:00:00 2001 From: Felitendo <95575686+Felitendo@users.noreply.github.com> Date: Tue, 21 Jul 2026 13:36:03 +0200 Subject: [PATCH] Prune superseded GitHub releases after publishing --- README.md | 5 +++-- scripts/update-package.sh | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 06ce7d0..3298664 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,9 @@ package's upstream for a new release. When one is found it: release of **this** repository (tag `-`), 3. updates the `PKGBUILD` (pkgver/pkgrel/sha256sums), test-builds it with `makepkg` and regenerates `.SRCINFO`, -4. commits the changes back to this repository, and -5. pushes `PKGBUILD` + `.SRCINFO` to the AUR. +4. commits the changes back to this repository, +5. pushes `PKGBUILD` + `.SRCINFO` to the AUR, and +6. deletes the package's superseded releases (older versions, tag included). The AUR packages themselves only download the prebuilt asset from step 2, so users don't need any build dependencies. diff --git a/scripts/update-package.sh b/scripts/update-package.sh index 1c5ee9e..1e8db1e 100644 --- a/scripts/update-package.sh +++ b/scripts/update-package.sh @@ -170,3 +170,22 @@ else git push origin HEAD:master echo "$pkg: pushed $ver-$rel to the AUR" fi + +### 6: prune superseded GitHub releases ###################################### + +# Build-mode packages get one release per version; once a newer version is +# fully published (asset built, PKGBUILD updated, AUR pushed - i.e. we got +# this far) the older releases are no longer referenced by anything, so drop +# them together with their tags. Runs every time to also catch leftovers. +cd "$repo_root" +if declare -f build_artifact >/dev/null; then + while IFS= read -r tag; do + [[ "$tag" == "$pkg-$ver" ]] && continue + rest="${tag#"$pkg-"}" + # only this package's tags: "-" (a pkgver never contains + # "-", which also keeps prefix-sharing package names apart) + [[ "$tag" == "$pkg-"* && "$rest" != *-* ]] || continue + echo "$pkg: deleting superseded release $tag" + gh release delete "$tag" --cleanup-tag --yes + done < <(gh release list --limit 100 --json tagName -q '.[].tagName') +fi