Prune superseded GitHub releases after publishing

This commit is contained in:
Felitendo committed 2026-07-21 13:36:03 +02:00
1 parent 0d9fea0a51
commit db74a6b65a
2 files changed
+22 -2

No files matched your search

+3 -2
View File
@@ -11,8 +11,9 @@ package's upstream for a new release. When one is found it:
release of **this** repository (tag `<pkgname>-<version>`), release of **this** repository (tag `<pkgname>-<version>`),
3. updates the `PKGBUILD` (pkgver/pkgrel/sha256sums), test-builds it with 3. updates the `PKGBUILD` (pkgver/pkgrel/sha256sums), test-builds it with
`makepkg` and regenerates `.SRCINFO`, `makepkg` and regenerates `.SRCINFO`,
4. commits the changes back to this repository, and 4. commits the changes back to this repository,
5. pushes `PKGBUILD` + `.SRCINFO` to the AUR. 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 The AUR packages themselves only download the prebuilt asset from step 2, so
users don't need any build dependencies. users don't need any build dependencies.
+19
View File
@@ -170,3 +170,22 @@ else
git push origin HEAD:master git push origin HEAD:master
echo "$pkg: pushed $ver-$rel to the AUR" echo "$pkg: pushed $ver-$rel to the AUR"
fi 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: "<pkg>-<version>" (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