From 6921e147dde1ce1f1d4e129ec2d1bf5f5f7df9a2 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Thu, 2 Jul 2026 19:23:04 +0000 Subject: [PATCH] =?UTF-8?q?ci(release):=20idempotent=20registry=20publish?= =?UTF-8?q?=20=E2=80=94=20survive=20re-tagged=20releases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A moved release tag re-fires the publish workflows, and the Gitea registries reject duplicate uploads with 409 (deb pool, rpm group, and the generic packages' versioned URLs; the channel aliases already pre-deleted). Delete any prior copy of the exact version before uploading (404 on first publish tolerated), so a republished tag overwrites instead of wedging — v0.5.0's retag left stale no-port-change artifacts published and every re-run red. Co-Authored-By: Claude Fable 5 --- .gitea/workflows/deb.yml | 8 ++++++++ .gitea/workflows/decky.yml | 9 +++++++-- .gitea/workflows/flatpak.yml | 5 ++++- .gitea/workflows/rpm.yml | 8 ++++++++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/deb.yml b/.gitea/workflows/deb.yml index 31b9de9..c42a9a6 100644 --- a/.gitea/workflows/deb.yml +++ b/.gitea/workflows/deb.yml @@ -126,6 +126,14 @@ jobs: run: | for DEB in dist/*.deb; do echo "uploading $DEB" + # A re-tagged release re-fires this workflow and the apt registry 409s on duplicate + # package versions — delete any prior copy of this exact name/version/arch first + # (404 on the first publish is fine). + NAME=$(dpkg-deb -f "$DEB" Package) + VER=$(dpkg-deb -f "$DEB" Version) + ARCH=$(dpkg-deb -f "$DEB" Architecture) + curl -fsS -o /dev/null --user "enricobuehler:$TOKEN" -X DELETE \ + "https://$REGISTRY/api/packages/$OWNER/debian/pool/$DISTRIBUTION/$COMPONENT/$NAME/$VER/$ARCH" || true # PAT owner (enricobuehler), not the push actor — matches docker.yml's registry login. curl -fsS --user "enricobuehler:$TOKEN" --upload-file "$DEB" \ "https://$REGISTRY/api/packages/$OWNER/debian/pool/$DISTRIBUTION/$COMPONENT/upload" diff --git a/.gitea/workflows/decky.yml b/.gitea/workflows/decky.yml index aae3d00..0270a86 100644 --- a/.gitea/workflows/decky.yml +++ b/.gitea/workflows/decky.yml @@ -122,8 +122,13 @@ jobs: TOKEN: ${{ secrets.REGISTRY_TOKEN }} run: | BASE="https://$REGISTRY/api/packages/$OWNER/generic/$PACKAGE" - # 1) Immutable, versioned URL + its update manifest (the manifest's `artifact` points - # here, so the published sha256 keeps matching what Decky later downloads). + # 1) Versioned URL + its update manifest (the manifest's `artifact` points here, so the + # published sha256 keeps matching what Decky later downloads). A re-tagged release + # re-fires this workflow and the registry 409s on duplicate uploads — delete any + # prior copy of this version first (404 on the first publish is fine). + for f in punktfunk.zip manifest.json; do + curl -fsS -o /dev/null --user "enricobuehler:$TOKEN" -X DELETE "$BASE/$VERSION/$f" || true + done curl -fsS --user "enricobuehler:$TOKEN" --upload-file "$RUNNER_TEMP/punktfunk.zip" \ "$BASE/$VERSION/punktfunk.zip" curl -fsS --user "enricobuehler:$TOKEN" --upload-file "$RUNNER_TEMP/manifest.json" \ diff --git a/.gitea/workflows/flatpak.yml b/.gitea/workflows/flatpak.yml index 2b9ff75..62f31ca 100644 --- a/.gitea/workflows/flatpak.yml +++ b/.gitea/workflows/flatpak.yml @@ -133,7 +133,10 @@ jobs: TOKEN: ${{ secrets.REGISTRY_TOKEN }} run: | BASE="https://$REGISTRY/api/packages/$OWNER/generic/$PACKAGE" - # 1) Immutable, versioned URL. + # 1) Versioned URL. A re-tagged release re-fires this workflow and the registry 409s on + # duplicate uploads — delete any prior copy first (404 on the first publish is fine). + curl -fsS -o /dev/null --user "enricobuehler:$TOKEN" -X DELETE \ + "$BASE/$VERSION/$BUNDLE" || true curl -fsS --user "enricobuehler:$TOKEN" --upload-file "$BUNDLE" \ "$BASE/$VERSION/$BUNDLE" echo "published $BASE/$VERSION/$BUNDLE" diff --git a/.gitea/workflows/rpm.yml b/.gitea/workflows/rpm.yml index bc82a8d..64048bc 100644 --- a/.gitea/workflows/rpm.yml +++ b/.gitea/workflows/rpm.yml @@ -103,6 +103,14 @@ jobs: for rpm in dist/*.rpm; do case "$rpm" in *debuginfo*|*debugsource*) echo "skip $rpm"; continue;; esac echo "uploading $rpm" + # A re-tagged release re-fires this workflow and the rpm registry 409s on duplicate + # package versions — delete any prior copy of this exact name/version-release/arch + # first (404 on the first publish is fine). + NAME=$(rpm -qp --qf '%{NAME}' "$rpm" 2>/dev/null) + VR=$(rpm -qp --qf '%{VERSION}-%{RELEASE}' "$rpm" 2>/dev/null) + ARCH=$(rpm -qp --qf '%{ARCH}' "$rpm" 2>/dev/null) + curl -fsS -o /dev/null --user "enricobuehler:$TOKEN" -X DELETE \ + "https://$REGISTRY/api/packages/$OWNER/rpm/$GROUP/package/$NAME/$VR/$ARCH" || true curl -fsS --user "enricobuehler:$TOKEN" --upload-file "$rpm" \ "https://$REGISTRY/api/packages/$OWNER/rpm/$GROUP/upload" done