feat: print one project's version with version --current --project-name - #28
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
version --currentcan only produce a capturable value for a single-project repository. With several projects it prints them labeled:which is readable but not assignable, so
VERSION=$(autover version --current)silently becomes multi-line text. A pipeline publishing more than one artifact from one repository has no way to ask for the version it needs.This adds
--project-nametoversion, meaningful alongside--current:Bare output regardless of how many projects are configured. The name matches exactly as
change --project-namealready does.Why it came up
A container-image repository that builds two images from two Dockerfiles. Two projects with their own
Pathgives them independent versions, which is what you want — but then the publish step can't read either one. The alternatives were worse: parse the labeled display format in shell, or collapse both images onto one version they don't actually share.Behaviour
VERSION=""and publishes an untagged or mis-tagged artifact — a silent failure in exactly the place it hurts.Pathsdrift is an error. A project usingPathsshares one version across its files by definition. If those files disagree, printing the first would quietly publish a version that doesn't match what's in the other file, so it says so instead.VersionFromTagalready prints a single repository-wide version; naming a project there is redundant but still validated, so a typo is caught rather than ignored.Tests
Three added to
VersionCommandTests, alongside the existing single-project--currenttest:--project-namestill print labeled. Asserts the contract the new option exists to work around, which had no coverage at all.--project-nameprints that project bare, with nothing about the other one.UserError, names what is configured, no stack trace, empty stdout.Full suite: 103 integration, 190 unit, 0 failures.
Note for anyone running these locally:
dotnet testreports "Zero tests ran" for these projects — TUnit builds self-hosting test executables, so runtest/AutoVer.IntegrationTests/bin/Debug/net10.0/AutoVer.IntegrationTestsdirectly (optionally with--treenode-filter).