Read the release version from LLamaSharp.csproj - #1427
Conversation
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.
There was a problem hiding this comment.
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.shto read<Version>viadotnet msbuild -getProperty:Version, validate it asx.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.shwithout 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.
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.
There was a problem hiding this comment.
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
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:LLamaSharp.csprojwas ignoredThis PR also adds 2 guards:
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.