Skip to content

chore(versioning): collapse 8 stamping sites down to one CI step#115

Merged
GordonBeeming merged 2 commits into
mainfrom
gb/versioning-overhaul
May 21, 2026
Merged

chore(versioning): collapse 8 stamping sites down to one CI step#115
GordonBeeming merged 2 commits into
mainfrom
gb/versioning-overhaul

Conversation

@GordonBeeming
Copy link
Copy Markdown
Owner

Summary

  • Stops the per-PR chore of bumping a date string across 8 files. Source files now carry 0.0.0-dev forever; CI computes today's date + iteration and stamps it where it's needed.
  • Fixes the schema/reality mismatch: .N is now "Nth release of the day" (via gh release list), the way docs/versioning.md always said it was. The next merged PR releases as cli-v2026.05.21.1 instead of .591.
  • Squashes a latent bug in release-cli that copied the shell scripts into release/ before the stamp step, so the released copilot_here.sh / .ps1 were going out unstamped.

Test plan

  • CI compute-version job logs Dev-stamp version: 2026.05.21.0 on this PR build.
  • CI test-shell-functions job runs copilot_here --version and the YYYY.MM.DD format regex passes on all four OS matrix entries.
  • After merge, the new release tag matches cli-v2026.05.21.1 (not .591) and the copilot_here.sh attached to the release has COPILOT_HERE_VERSION="2026.05.21.1" in line 8.
  • Installed binary's --version reports 2026.05.21.1 end-to-end (download from cli-latest, run --version).
  • Existing users' auto-update prompt fires once and pulls the new release correctly.

The repo's documented schema -- `YYYY.MM.DD.N` where `N` is the Nth release
of the day -- never matched reality. Every PR carried a chore tax: bump the
date in `VERSION`, stamp it into the two shell scripts (4 lines), the
BuildInfo const, and the example versions in copilot-instructions.md. Eight
files, every PR, just to make the version match today.

This rip-and-replace:

- Deletes `VERSION` and `scripts/bump-version.sh`. Neither is needed.
- Source files (copilot_here.sh, .ps1, BuildInfo.cs) now carry the literal
  `0.0.0-dev` sentinel forever. `BuildInfo.BuildDate` derives its value from
  the assembly's InformationalVersion at runtime and strips the git-sha
  suffix, so the const is no longer a stamp target.
- `Directory.Build.props` falls back to `today.0` instead of reading from
  `VERSION`. Local `dotnet run -- --version` still prints a YYYY.MM.DD.N
  string the format tests accept.
- The `compute-version` CI job replaces `github.run_number` (currently 591,
  meaningless) with `gh release list` count of `cli-v$DATE.* + 1` on main
  pushes, matching the documented schema. PR/schedule/branch dispatch builds
  stamp `today.0`.
- `scripts/stamp-version.sh` slimmed to just the two shell scripts, switched
  to `~` as the sed delimiter so the alternation regex doesn't get eaten by
  BSD sed on macOS.
- `release-cli` stamps before copying the scripts into `release/` (the old
  order stamped source after the cp, so the released scripts were
  unstamped).
- `test-shell-functions` now stamps the scripts before sourcing, so the
  auto-update check inside copilot_here.sh doesn't see a remote-newer
  release and prompt during the --version test.
- `docs/versioning.md` and the `.github/copilot-instructions.md` "Script
  Versioning" block rewritten around "merge a PR, CI handles it".

After this lands, the next merged PR becomes `cli-v2026.05.21.1`, not
`.591`, and no version literal in source ever changes again.

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: GitButler <gitbutler@gitbutler.com>
@GordonBeeming GordonBeeming marked this pull request as ready for review May 21, 2026 11:04
Copilot AI review requested due to automatic review settings May 21, 2026 11:04
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request automates the versioning process by shifting from manual updates to a CI-driven workflow. It removes the central VERSION file, introduces 0.0.0-dev placeholders in shell scripts, and updates the .NET build logic to dynamically resolve versions from assembly attributes. Feedback was provided regarding the version parsing logic in BuildInfo.cs, specifically to ensure that the -dev suffix is correctly preserved for development builds instead of being stripped by the current string manipulation loop.

Comment thread app/Infrastructure/BuildInfo.cs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 248ae338bf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/publish.yml Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 restructures CopilotHere’s versioning so source files keep a permanent 0.0.0-dev placeholder and CI becomes the single authority that computes/stamps a real YYYY.MM.DD.N version into release artifacts and test runs.

Changes:

  • Removes the repo-root VERSION file and the scripts/bump-version.sh helper; local builds now default the binary version to UTC-today.0 via MSBuild.
  • Updates CI to compute YYYY.MM.DD.N as “Nth release of the UTC day” (via gh release list) and stamps shell wrappers before shell tests and release packaging.
  • Reworks BuildInfo.BuildDate to read from AssemblyInformationalVersion at runtime instead of being stamped into source.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
VERSION Removes the old single-source version file.
scripts/stamp-version.sh Now only stamps shell wrappers (supports dev sentinel + real versions) and avoids delimiter conflicts in sed.
scripts/bump-version.sh Deleted (no more manual bump workflow).
docs/versioning.md Updates docs to reflect CI-computed daily-iteration versioning and CI-only stamping.
Directory.Build.props Sets a local-build fallback version of UTC-today.0 when -p:CopilotHereVersion isn’t provided.
copilot_here.sh Replaces embedded version with 0.0.0-dev placeholder in source.
copilot_here.ps1 Replaces embedded version with 0.0.0-dev placeholder in source.
app/Infrastructure/BuildInfo.cs Computes build date/version from assembly metadata instead of a stamped constant.
.github/workflows/publish.yml Adds compute-version job (daily iteration) and stamps scripts before shell tests and release asset prep.
.github/copilot-instructions.md Updates contributor guidance to “CI sets versions; don’t edit by hand”.

Comment thread app/Infrastructure/BuildInfo.cs Outdated
Comment thread .github/workflows/publish.yml
…lease, anchor dev stamps to latest released N

Addresses 4 review threads on PR #115:

- BuildInfo.cs (gemini + copilot): the strip loop was cutting at '-' so an
  InformationalVersion of `0.0.0-dev` collapsed to `0.0.0`, losing the
  sentinel that signals an unstamped build. Added an explicit StartsWith
  check for the sentinel and removed `-` from the strip set — pre-release
  SemVer tags now survive the strip pass intact. Production InformationalVersion
  uses `.sha` (no pre-release marker), so the 5-segment cutoff and `+`
  metadata strip still handle the real release case.

- publish.yml compute-version gate (codex P1): a `workflow_dispatch` run
  triggered on `main` would publish (the gate downstream is just
  `event_name != schedule && ref == main`) but would stamp `${DATE}.0`,
  silently shipping a release version older than any `.N` already cut
  that day. Widened the `IS_RELEASE` gate to accept both `push` and
  `workflow_dispatch` when the ref is `main`. Manual re-runs of a release
  now correctly take the next iteration number.

- publish.yml dev-stamp value (copilot): the previous `${DATE}.0` for
  non-release builds meant that on a day where `cli-v${DATE}.1` was
  already cut, PR builds would source a script stamped older than
  `cli-latest`, and the shell wrappers' startup update-check would print
  the "Update available" prompt mid-test. Dev-stamps now use `${DATE}.${COUNT}`,
  matching the latest already-released number for the day (or `.0` if
  no release has happened yet). PR scripts can never be "older than"
  the day's latest release.

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: GitButler <gitbutler@gitbutler.com>
@GordonBeeming GordonBeeming merged commit 2db91eb into main May 21, 2026
31 checks passed
@GordonBeeming GordonBeeming deleted the gb/versioning-overhaul branch May 21, 2026 11:35
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.

2 participants