From d832e748ec1eb1554e7908ba0584178967275cf8 Mon Sep 17 00:00:00 2001 From: Faris Laptop Date: Mon, 20 Jul 2026 16:14:53 +0500 Subject: [PATCH] ci: guard on the tag itself, not the release object A tag can exist without a release (pushed by hand), and that still means the version is taken. Checking the tag makes the failure say 'bump the version' instead of surfacing a raw NuGet duplicate error. --- .gitea/workflows/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index f03f851..0476f40 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -36,6 +36,8 @@ jobs: # A published NuGet version can never be replaced, so refuse to re-run an # already released version instead of silently doing nothing. + # Checks the tag itself: a tag can exist without a release object (e.g. it + # was pushed by hand), and that still means the version is spoken for. - name: Refuse to release an existing version env: TOKEN: ${{ secrets.GITEA_TOKEN }} @@ -44,9 +46,9 @@ jobs: TAG="v${{ steps.version.outputs.value }}" CODE=$(curl -s -o /dev/null -w '%{http_code}' \ -H "Authorization: token $TOKEN" \ - "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/tags/$TAG") + "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/tags/$TAG") if [ "$CODE" = "200" ]; then - echo "::error::$TAG is already released. Bump in the csproj on dev, then merge again." + echo "::error::$TAG already exists — version ${{ steps.version.outputs.value }} is already released. Bump in src/CertifiEd.Client/CertifiEd.Client.csproj on dev, then merge into production again." exit 1 fi