Skip to content

Commit 34bb4fb

Browse files
jdetterclaude
andcommitted
Fix C# hotfix release: strip -hotfix suffix for NuGet package lookup
The release tag for a hotfix (e.g. v2.7.0-hotfix2) is passed straight through to the C# release, but `dotnet pack` derives the NuGet package version from the csproj <Version>, which is not bumped for a hotfix. So pack produces SpacetimeDB.*.2.7.0.nupkg while the publish step looked for ...2.7.0-hotfix2.nupkg and failed with "Package not found". Strip the -hotfix<N> suffix when building the NuGet package paths (and the summary output). We intentionally do not strip a generic prerelease suffix like -rc1, since those are baked into the csproj <Version> and are part of the real package version; only -hotfix is a tag-only concept. The Unity tag push keeps the full hotfix version. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 97638b7 commit 34bb4fb

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

tools/release/src/targets/csharp.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ fn run_cargo_ci_dlls() -> Result<(), String> {
3434
fn push_nuget_packages(version: &str, dry_run: bool) -> Result<(), String> {
3535
println!("\n=== Publishing NuGet Packages ===");
3636

37+
// The NuGet package version comes from the csproj `<Version>`, which is not bumped
38+
// for a hotfix. So `dotnet pack` produces e.g. `SpacetimeDB.Runtime.2.7.0.nupkg`
39+
// even when releasing tag `v2.7.0-hotfix2`. Strip the `-hotfix<N>` suffix so we look
40+
// up the packages that were actually produced.
41+
let version = version.split_once("-hotfix").map_or(version, |(base, _)| base);
42+
3743
let packages = vec![
3844
format!(
3945
"crates/bindings-csharp/BSATN.Runtime/bin/Release/SpacetimeDB.BSATN.Runtime.{}.nupkg",
@@ -361,11 +367,14 @@ impl ReleaseTarget for CSharpRelease {
361367

362368
println!("\n=== C# SDK Release Complete ===");
363369
if !self.dry_run {
370+
// NuGet package versions come from the csproj `<Version>` and are not bumped
371+
// for a hotfix, so report the base version here (see push_nuget_packages).
372+
let package_version = version.split_once("-hotfix").map_or(version, |(base, _)| base);
364373
println!("NuGet packages published:");
365-
println!(" - SpacetimeDB.BSATN.Runtime.{}", version);
366-
println!(" - SpacetimeDB.Runtime.{}", version);
367-
println!(" - SpacetimeDB.ClientSDK.{}", version);
368-
println!(" - SpacetimeDB.ClientSDK.Godot.{}", version);
374+
println!(" - SpacetimeDB.BSATN.Runtime.{}", package_version);
375+
println!(" - SpacetimeDB.Runtime.{}", package_version);
376+
println!(" - SpacetimeDB.ClientSDK.{}", package_version);
377+
println!(" - SpacetimeDB.ClientSDK.Godot.{}", package_version);
369378
println!("\nUnity SDK published:");
370379
println!(" - Branch: release/latest");
371380
println!(" - Tag: v{}", version);

0 commit comments

Comments
 (0)