diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e2e8e08..587c042 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -213,11 +213,29 @@ jobs: if [ -n "${{ steps.version.outputs.previous_tag }}" ]; then NOTES_FLAG="--notes-start-tag ${{ steps.version.outputs.previous_tag }}" fi - gh release create "${{ steps.version.outputs.version }}" \ - --title "v${{ steps.version.outputs.version }}" \ - --generate-notes \ - $NOTES_FLAG \ - ./artifacts/*.nupkg + # The package is already on nuget.org by this point, so a transient GitHub API failure here + # leaves a published package with no tag. The next build then recomputes the SAME version, + # pushes a duplicate that --skip-duplicate swallows silently, and the version after it never + # ships. Observed three times on 2026-08-17 during a GitHub incident (HTTP 503/504). + # Retry, and treat an already-created release as success so a re-run is safe. + for attempt in 1 2 3 4 5; do + if gh release create "${{ steps.version.outputs.version }}" \ + --title "v${{ steps.version.outputs.version }}" \ + --generate-notes \ + $NOTES_FLAG \ + ./artifacts/*.nupkg; then + echo "Release ${{ steps.version.outputs.version }} created." + exit 0 + fi + if gh release view "${{ steps.version.outputs.version }}" >/dev/null 2>&1; then + echo "Release ${{ steps.version.outputs.version }} already exists - an earlier attempt succeeded." + exit 0 + fi + echo "Attempt $attempt failed; retrying in 20s..." + sleep 20 + done + echo "::error::Could not create the GitHub release for ${{ steps.version.outputs.version }} after 5 attempts. The package is most likely already on nuget.org, so the tag must be created by hand or the next release will silently republish this version: git tag ${{ steps.version.outputs.version }} && git push origin ${{ steps.version.outputs.version }}" + exit 1 - name: Comment released version on merged PR if: always() @@ -298,11 +316,26 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh release create "${{ steps.version.outputs.version }}" \ - --title "v${{ steps.version.outputs.version }} (pre-release)" \ - --notes "Pre-release from \`${{ github.head_ref }}\` branch." \ - --prerelease \ - ./artifacts/*.nupkg + # Same reasoning as the release job: the pre-release package is pushed before this runs, so a + # transient API failure would leave it published with no tag to match. + for attempt in 1 2 3 4 5; do + if gh release create "${{ steps.version.outputs.version }}" \ + --title "v${{ steps.version.outputs.version }} (pre-release)" \ + --notes "Pre-release from \`${{ github.head_ref }}\` branch." \ + --prerelease \ + ./artifacts/*.nupkg; then + echo "Pre-release ${{ steps.version.outputs.version }} created." + exit 0 + fi + if gh release view "${{ steps.version.outputs.version }}" >/dev/null 2>&1; then + echo "Pre-release ${{ steps.version.outputs.version }} already exists - an earlier attempt succeeded." + exit 0 + fi + echo "Attempt $attempt failed; retrying in 20s..." + sleep 20 + done + echo "::error::Could not create the GitHub pre-release for ${{ steps.version.outputs.version }} after 5 attempts." + exit 1 docs: needs: release diff --git a/Sample/Tharga.Cache.Console/Tharga.Cache.Console.csproj b/Sample/Tharga.Cache.Console/Tharga.Cache.Console.csproj index 25f36ce..0d184a7 100644 --- a/Sample/Tharga.Cache.Console/Tharga.Cache.Console.csproj +++ b/Sample/Tharga.Cache.Console/Tharga.Cache.Console.csproj @@ -7,7 +7,7 @@ - + diff --git a/Tharga.Cache.Blazor/Tharga.Cache.Blazor.csproj b/Tharga.Cache.Blazor/Tharga.Cache.Blazor.csproj index b99bdf0..f7beb8a 100644 --- a/Tharga.Cache.Blazor/Tharga.Cache.Blazor.csproj +++ b/Tharga.Cache.Blazor/Tharga.Cache.Blazor.csproj @@ -37,7 +37,7 @@ - + diff --git a/Tharga.Cache.Mcp/Tharga.Cache.Mcp.csproj b/Tharga.Cache.Mcp/Tharga.Cache.Mcp.csproj index f8ae5e1..d164cc0 100644 --- a/Tharga.Cache.Mcp/Tharga.Cache.Mcp.csproj +++ b/Tharga.Cache.Mcp/Tharga.Cache.Mcp.csproj @@ -43,7 +43,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Tharga.Cache.MongoDB/Tharga.Cache.MongoDB.csproj b/Tharga.Cache.MongoDB/Tharga.Cache.MongoDB.csproj index f02b747..e92fc03 100644 --- a/Tharga.Cache.MongoDB/Tharga.Cache.MongoDB.csproj +++ b/Tharga.Cache.MongoDB/Tharga.Cache.MongoDB.csproj @@ -49,7 +49,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - +