Skip to content

Read the release version from LLamaSharp.csproj - #1427

Merged
martindevans merged 3 commits into
SciSharp:masterfrom
m0nsky:fix/release-version-from-csproj
Aug 24, 2026
Merged

Read the release version from LLamaSharp.csproj#1427
martindevans merged 3 commits into
SciSharp:masterfrom
m0nsky:fix/release-version-from-csproj

Conversation

@m0nsky

@m0nsky m0nsky commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

This PR changes the release workflow to read the release version from LLamaSharp.csproj. Previously, it would get the latest LLamaSharp package from nuget, read the version and bump it, however, this has 2 issues:

  • Release version in LLamaSharp.csproj was ignored
  • If a release fails (like we've now had 2 times in a row) leaves nuget.org behind, so release versions would go out of sync

This PR also adds 2 guards:

  • Check if the version in the csproj is a valid x.y.z (if not, abort)
  • Check if the release version in the csproj already exists on nuget (if so, abort)

After this gets merged, there will be one more PR to fix docs that have been failing since 0.26.0 (stuck on 0.25.0). After that, we should probably do another version increment to 0.30.0 and we should be ready to get the release up.

The release version was derived from the newest LLamaSharp package on nuget.org and
then bumped, so a failed release silently pinned the baseline and the csproj version
was ignored. It is now taken verbatim from LLama/LLamaSharp.csproj.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the GitHub release automation so the version shipped to NuGet is taken directly from LLama/LLamaSharp.csproj (instead of inferring/bumping from the latest NuGet version), aiming to prevent version drift after failed releases and to make the csproj the single source of truth.

Changes:

  • Update .github/prepare_release.sh to read <Version> via dotnet msbuild -getProperty:Version, validate it as x.y.z, and use it verbatim for packing.
  • Add a NuGet “already published” guard to fail early when the target version is already present on nuget.org.
  • Simplify the patch/minor release workflows to call prepare_release.sh without bumping arguments.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/release-patch.yml Stop passing bump parameters; rely on prepare_release.sh reading version from csproj.
.github/workflows/release-minor.yml Stop passing bump parameters; rely on prepare_release.sh reading version from csproj.
.github/prepare_release.sh Read/validate version from csproj, check for already-published version on NuGet, and pack using that version.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/prepare_release.sh Outdated
m0nsky added 2 commits August 24, 2026 17:16
The duplicate-version guard treated a failed or truncated response as "not published"
and carried on. It now tests curl's exit status, bounds the request with timeouts and
retries, and aborts if the version list cannot be read.
The triggers fire on pull_request "closed", which happens whether or not the PR was
merged, so closing a labelled PR without merging it would start a real release.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (2)

Previously missed (1) — in code that hasn't changed since the last review.

.github/prepare_release.sh:6

  • The header comment says the version from LLamaSharp.csproj is used "verbatim", but the script actually enforces a strict x.y.z format (and trims whitespace). This is slightly misleading for future maintainers—please update the comment to reflect the validation/guard behavior.

This issue also appears on line 30 of the same file.

# The version to publish is read from LLama/LLamaSharp.csproj and used verbatim.
# Bump <Version> there in the release PR: whatever it says is exactly what ships.
version=$(dotnet msbuild ./LLama/LLamaSharp.csproj -getProperty:Version)
version="${version//[$'\t\r\n ']/}"

.github/prepare_release.sh:33

  • The PR description says the workflow will abort if the csproj version does not already exist on NuGet, but the guard implemented here aborts when the version does already exist (which matches the intent of preventing duplicate re-releases). Please align the PR description wording so it doesn't contradict the behavior.
if echo "$published" | grep -Fq "\"$version\""; then
  echo "LLamaSharp $version is already published on nuget.org."
  echo "Bump <Version> in LLama/LLamaSharp.csproj before releasing again."
  exit 1

@martindevans
martindevans merged commit ddf8bdb into SciSharp:master Aug 24, 2026
8 checks passed
@m0nsky
m0nsky deleted the fix/release-version-from-csproj branch August 24, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants