Target 1.1.0, fix the release-tag pattern, and report the version in CI - #222
Merged
Conversation
Three things, all in service of cutting 1.1.0 cleanly. **Land on 1.1.0.** versionHeightOffset goes -1 -> -3. The offset is a fixed shift, not a pin: height counts commits since the `version` property changed, and two more have landed since (#221, and this one), so -1 would compute 1.1.1. Editing versionHeightOffset does *not* reset the height - verified, height stays 3 - so the offset has to absorb the drift. -3 puts this commit at exactly 1.1.0, which is what main will compute once this squash-merges (one commit on top of 78f0fc7 either way). **Fix the release-tag pattern**, which has never worked. publicReleaseRefSpec requires `^refs/tags/v\d+\.\d+`, but every tag this repo has ever cut is unprefixed - 1.0.52, 1.0.48, 1.0.45 and so on - so the regex cannot match any of them. Checking out the real 1.0.52 tag and asking nbgv gives `1.0.52-g7a36975e31`, PublicRelease False: a tag-triggered build has always produced a -g suffixed version, and the packages that shipped must have come from main builds instead. Relaxed to `v?`, so both spellings work; at an unprefixed 1.1.0 tag nbgv now reports a clean 1.1.0, PublicRelease True. Same fix, same reason, as StackExchange.Redis 611e478. **Report the computed version in CI**, modelled on StackExchange.Redis's CI.yml: a step that writes the NuGetPackageVersion to the job summary and the log, placed before restore/build so it stays legible when a later step fails. Cutting a release then means reading that line off a green main build and tagging with exactly it.
There was no release workflow at all - dotnet.yml pushes to MyGet on main, and nothing publishes to nuget.org, so every release to date must have been pushed by hand. That is also why the broken tag pattern went unnoticed. Triggered by a published GitHub Release, with workflow_dispatch as a dry run that does everything except the tag check and the push, so the pipeline can be proven without cutting a release. The guard is the point: nbgv computes the version from version.json plus commit height, so the tag name does not set it and a mistyped tag would otherwise ship a package that disagrees with its release. The step compares the two and fails loudly instead. A leading "v" is stripped, matching the v? pattern this PR also fixes. Publishes **both** packages: Dapper.AOT and Dapper.Advisor are both on nuget.org at 1.0.52, and both set GeneratePackageOnBuild for Release, so a Release build produces the pair and the collect step gathers them with the same glob dotnet.yml already uses. They are uploaded as a run artifact before the push, so a failed push does not cost the build. Auth is Trusted Publishing (OIDC) - no long-lived key in the repo. That needs setup outside this file, recorded in the header comment: a GitHub environment named "release", a NUGET_USER secret, and a trusted-publishing policy on nuget.org for *each* of the two packages. No further versionHeightOffset delta: the repo squash-merges, so this lands as one commit on main regardless of how many are on the branch, and -3 still computes 1.1.0.
release.yml now publishes to nuget.org on a tagged release, so the MyGet push on every main build is both redundant and a second, unversioned place for packages to appear. Removed, along with the Pack and Purge steps that existed only to feed it - packaging is still exercised on every build, because both src projects set GeneratePackageOnBuild for Release, so a broken nuspec still fails CI. That also retires the MYGETAPIKEY secret; nothing references it now. Badges: there were none at all, so this adds rather than updates - build status, and current nuget.org versions for both published packages. Worth having now that a release actually lands on nuget.org by a route anyone can see.
The new net48 CI step caught this on its first real outing, which is exactly what it was added for: CommandDefinitionOverloads.output.netfx.txt still claimed "2 skipped silently" and carried no DAP057, because #220 was developed on Linux and only the .output.* goldens can be regenerated there - the .output.netfx.* twins need an actual net48 run. Swept the rest rather than fixing just the one that failed: comparing every .output.txt against its .output.netfx.txt, this is the *only* pair whose diagnostic ids differ, and the only one whose scorecard buckets disagree. The other scorecard differences are legitimate - netfx genuinely has fewer call-sites (15 of 15 vs 17 of 17, and so on), and DateOnly.net6 is gated off netfx entirely. The generated-code goldens are untouched: #220 added diagnostics, not code, and the handled count is 1 of 3 on both sides either way.
The first real run printed `1.1.4-g90538b49e3` on this PR, which is correct and misleading at once: a PR builds refs/pull/N/merge, whose height includes every branch commit plus the merge, so it is not the number that will ship. Squash-merged onto main the same work computes 1.1.0. Since the whole point of this step is "read this, tag with it", that gap is a live mis-tag waiting to happen. On main the summary now says to tag with exactly that value; anywhere else it says, in the summary itself, that the number is not the one that would ship and to read it off a main run instead. The log line carries the ref either way. release.yml's guard would catch the resulting mismatch, but not hitting it beats being caught by it.
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.
Three things, all in service of cutting 1.1.0 cleanly.
1. Land on 1.1.0
versionHeightOffsetgoes-1→-3.The offset is a fixed shift, not a pin: height counts commits since the
versionproperty changed, and two more have landed since it opened (#221, plus this commit). EditingversionHeightOffsetdoes not reset the height — verified, it stays at 3 — so the offset has to absorb the drift:-1(current)-3Confirmed locally:
{'VersionHeight': 3, 'BuildNumber': 0, 'NuGetPackageVersion': '1.1.0-…'}. The-gsuffix there is only because a branch isn't a public-release ref; main will compute a clean1.1.0, since a squash-merge puts exactly one commit on top of78f0fc7— the same height I measured.2. Fix the release-tag pattern — it has never worked
publicReleaseRefSpecrequires^refs/tags/v\d+\.\d+, but every tag this repo has ever cut is unprefixed:1.0.52,1.0.48,1.0.45, … The regex cannot match any of them.Demonstrated on real history — checking out the actual
1.0.52tag and asking nbgv:So a tag-triggered build has always produced a
-g-suffixed version; the packages that actually shipped must have come frommainbuilds instead, which is why this was never noticed. Relaxed tov?so both spellings work — at an unprefixed1.1.0tag nbgv now reports a clean1.1.0,PublicRelease: True.Same fix, same reason, as StackExchange.Redis
611e478— which also had to bump the offset in the same commit, for the same "one more commit" reason.3. Report the computed version in CI
Modelled on StackExchange.Redis's
CI.yml:Placed before restore/build, so the version stays legible even when a later step fails. Cutting a release then means reading that line off a green
mainbuild and tagging with exactly it.Checking this PR's own run
Two things to eyeball when CI goes green here:
1.1.0-g<hash>— the-gis expected on a PR branch, and becomes clean1.1.0on main;nbgvis on PATH after thedotnet/nbgvaction (its README says it installs the CLI, but this is the first step to depend on that).4. Add
release.yml(second commit)There was no release workflow at all —
dotnet.ymlpushes to MyGet on main, and nothing publishes to nuget.org, so every release to date must have been pushed by hand. That is also why the broken tag pattern above went unnoticed for so long.Triggered by a published GitHub Release, with
workflow_dispatchas a dry run that does everything except the tag check and the push — so the pipeline can be proven, and the packages inspected via the run artifact, without cutting a release.The guard is the point. nbgv computes the version from
version.json+ commit height, so the tag name does not set it; a mistyped tag would otherwise ship a package that disagrees with its release. The step compares the two and fails loudly instead. A leadingvis stripped, matching thev?pattern fixed above.Publishes both packages —
Dapper.AOTandDapper.Advisorare both on nuget.org at 1.0.52, and both setGeneratePackageOnBuildfor Release, so a Release build produces the pair and the collect step gathers them with the same globdotnet.ymlalready uses. They upload as a run artifact before the push, so a failed push doesn't cost the build.Setup needed outside this repo (also recorded in the file header)
release;NUGET_USERrepository secret holding the nuget.org profile to publish as;DapperLib, RepositoryDapperAOT, Workflow Filerelease.yml, Environmentrelease.No further offset delta needed
Adding a second commit to this branch does not need another
versionHeightOffsetchange: the repo squash-merges, so this lands as one commit on main regardless. Simulated it rather than assuming — squash-merging this branch ontomaingives:-3still computes 1.1.0. (The-gsuffix is only because the simulation branch isn'tmain.)