fix(ci): wipe all existing versions before upload to kill zombie DB entries
All checks were successful
Build and publish packages / build-and-publish (push) Successful in 18s

Gitea's Arch registry doesn't regenerate the repo DB on pkgver change —
old entries linger as zombies (e.g. moonarch-git r99 stuck in moonarch.db
even though only r105 exists as a package). List all versions of each
built package and DELETE them before the upload so the DB gets rebuilt
cleanly. Bump moonarch-git pkgrel to force a rebuild and exercise the fix.
This commit is contained in:
nevaforget 2026-04-20 14:09:33 +02:00
parent ea44cb33c4
commit c2ccdccff4
2 changed files with 32 additions and 6 deletions

View File

@ -67,6 +67,37 @@ jobs:
continue
fi
# Collect unique package names (includes split packages like
# foo + foo-debug). We delete ALL existing versions of each
# before upload: Gitea's Arch registry doesn't fully regenerate
# the repo DB on pkgver change — old entries stick around as
# zombies and block pacman from seeing updates.
declare -A SEEN_NAMES
for PKG_FILE in "${PKG_FILES[@]}"; do
base="${PKG_FILE%.pkg.tar.zst}"
base="${base%-*}"; base="${base%-*}"; base="${base%-*}"
SEEN_NAMES["$base"]=1
done
sudo pacman -S --needed --noconfirm jq
for PKG_NAME in "${!SEEN_NAMES[@]}"; do
echo "==> Clearing existing versions of $PKG_NAME"
# Listing API returns every matching package across all types,
# so we filter by exact name client-side.
VERSIONS=$(curl -s \
-H "Authorization: token ${{ secrets.PKG_REGISTRY_TOKEN }}" \
"https://gitea.moonarch.de/api/v1/packages/nevaforget?type=arch&q=${PKG_NAME}&page=1&limit=100" \
| jq -r --arg n "$PKG_NAME" '.[] | select(.name==$n) | .version')
for V in $VERSIONS; do
echo " delete $PKG_NAME@$V"
DEL_CODE=$(curl -s -o /dev/null -w '%{http_code}' -X DELETE \
-H "Authorization: token ${{ secrets.PKG_REGISTRY_TOKEN }}" \
"https://gitea.moonarch.de/api/v1/packages/nevaforget/arch/${PKG_NAME}/${V}")
echo " HTTP $DEL_CODE"
done
done
for PKG_FILE in "${PKG_FILES[@]}"; do
base="${PKG_FILE%.pkg.tar.zst}"
PKG_ARCH="${base##*-}"
@ -79,11 +110,6 @@ jobs:
echo "==> Uploading $PKG_FILE ($PKG_NAME $FULL_VER $PKG_ARCH)"
# Delete old version if it exists (ignore 404)
curl -s -o /dev/null -X DELETE \
-H "Authorization: token ${{ secrets.PKG_REGISTRY_TOKEN }}" \
"https://gitea.moonarch.de/api/packages/nevaforget/arch/moonarch/${PKG_NAME}/${FULL_VER}/${PKG_ARCH}" || true
# Upload new version. Capture HTTP status — curl -sf alone
# hides the response, and a silent failure lets the run green
# while the registry stays stale.

View File

@ -5,7 +5,7 @@
pkgname=moonarch-git
pkgver=r105.f4f6ede
pkgrel=7
pkgrel=8
pkgdesc="Moonarch desktop environment defaults — Niri, Waybar, Catppuccin Mocha"
arch=('any')
url="https://gitea.moonarch.de/nevaforget/moonarch"