From ac7646bd83f56593b795defc5393b7e188f2d49b Mon Sep 17 00:00:00 2001 From: giammin Date: Thu, 23 Jul 2026 12:57:13 +0200 Subject: [PATCH 1/2] fix(ci): derive nuget package version from the pushed tag The publish workflow rebuilt whatever version was hardcoded in src/Directory.Build.targets (PackageVersion = $(VersionPrefix).3 = 1.1.3) regardless of the git tag. Since 1.1.3 was already on nuget.org, the push hit a 409 that --skip-duplicate swallowed, leaving the pipeline green while publishing nothing for the v1.1.4 tag. Pass -p:PackageVersion=${GITHUB_REF_NAME#v} so the published version follows the tag. The command-line global property overrides the hardcoded value. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/nuget-publish.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nuget-publish.yml b/.github/workflows/nuget-publish.yml index cd0b53e..1ada5ae 100644 --- a/.github/workflows/nuget-publish.yml +++ b/.github/workflows/nuget-publish.yml @@ -18,7 +18,10 @@ jobs: - name: Restore dependencies run: dotnet restore - name: Build - run: dotnet build --no-restore -c Release + # Derive the package version from the pushed tag (e.g. v1.1.4 -> 1.1.4). + # -p:PackageVersion is a global MSBuild property, so it overrides the value + # hardcoded in src/Directory.Build.targets. + run: dotnet build --no-restore -c Release -p:PackageVersion=${GITHUB_REF_NAME#v} - name: Test run: dotnet test --no-build --verbosity normal -c Release - name: NuGet login (OIDC → temp API key) # Get a short-lived NuGet API key From 3c38758199810c30e0ba090e399dc982f090f005 Mon Sep 17 00:00:00 2001 From: giammin Date: Thu, 23 Jul 2026 13:05:12 +0200 Subject: [PATCH 2/2] fix(ci): drop --skip-duplicate and remove hardcoded version trap - Remove --skip-duplicate from the nuget push so a failed/duplicate push fails the pipeline instead of passing silently (this is what hid the v1.1.4 non-publish). - Delete src/Directory.Build.targets, which hardcoded PackageVersion to $(VersionPrefix).3 (=1.1.3), carried a stray versionBuild=4, and set a non-deterministic date-based FileVersion (conflicting with Deterministic). Version now derives from $(VersionPrefix) locally and from -p:Version (the pushed tag) in the publish workflow, so PackageVersion, FileVersion and AssemblyVersion all track the release version. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/nuget-publish.yml | 8 ++++---- src/Directory.Build.targets | 12 ------------ 2 files changed, 4 insertions(+), 16 deletions(-) delete mode 100644 src/Directory.Build.targets diff --git a/.github/workflows/nuget-publish.yml b/.github/workflows/nuget-publish.yml index 1ada5ae..cd0b3dd 100644 --- a/.github/workflows/nuget-publish.yml +++ b/.github/workflows/nuget-publish.yml @@ -19,9 +19,9 @@ jobs: run: dotnet restore - name: Build # Derive the package version from the pushed tag (e.g. v1.1.4 -> 1.1.4). - # -p:PackageVersion is a global MSBuild property, so it overrides the value - # hardcoded in src/Directory.Build.targets. - run: dotnet build --no-restore -c Release -p:PackageVersion=${GITHUB_REF_NAME#v} + # -p:Version is a global MSBuild property; PackageVersion, FileVersion and + # AssemblyVersion all derive from it. + run: dotnet build --no-restore -c Release -p:Version=${GITHUB_REF_NAME#v} - name: Test run: dotnet test --no-build --verbosity normal -c Release - name: NuGet login (OIDC → temp API key) # Get a short-lived NuGet API key @@ -30,4 +30,4 @@ jobs: with: user: ${{ secrets.NUGET_USER }} - name: Push - run: dotnet nuget push "./build/*.symbols.nupkg" --skip-duplicate --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json + run: dotnet nuget push "./build/*.symbols.nupkg" --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets deleted file mode 100644 index 3c2d550..0000000 --- a/src/Directory.Build.targets +++ /dev/null @@ -1,12 +0,0 @@ - - - - 4 - 0 - $([System.DateTime]::Now.ToString(yyMM)).$([System.DateTime]::Now.ToString(dd)) - $(VersionPrefix).$(buildNumber)$(versionBuild)$(versionRevision) - $(VersionPrefix).$(versionBuild).$(versionRevision) - $(VersionPrefix).3 - $(PackageVersion) - - \ No newline at end of file