diff --git a/.gitea/workflows/build-and-publish.yaml b/.gitea/workflows/build-and-publish.yaml index 7a21964..5aa2e01 100644 --- a/.gitea/workflows/build-and-publish.yaml +++ b/.gitea/workflows/build-and-publish.yaml @@ -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. diff --git a/moonarch-git/PKGBUILD b/moonarch-git/PKGBUILD index 3c6d166..8e121b8 100644 --- a/moonarch-git/PKGBUILD +++ b/moonarch-git/PKGBUILD @@ -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"