Skip to content

feat(prepare): Bump untagged release units from their project files' version - #947

Merged
BYK merged 4 commits into
masterfrom
feat/bump-from-manifest-version
Nov 1, 2026
Merged

BYK merged 4 commits into
masterfrom
feat/bump-from-manifest-version

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Refs #946

craft prepare patch|minor|major (and auto) bump the latest tag for the release unit's tag prefix, and fall back to 0.0.0 when there is none. So a workspace's first release ignored its manifest: packages/cli at 1.0.0-dev.0 with no cli@ tag released 0.1.0 for minor, which is why getsentry/toolkit's release workflow computes the version itself with semver -i.

When there's no matching tag, the bump now starts from the version declared in the release unit's project files (the selected workspace's directory, or the config directory without one). 1.0.0-dev.0 becomes 1.0.0 for any bump, matching semver -i. Tags still win when they exist.

Reading the version lives next to automatic version bumping: targets that implement bumpVersion() can also implement a static readVersion(), and readProjectVersion() asks each configured target in config order, taking the first valid semver above 0.0.0. Placeholders such as 0.0.0-development (every bump of which is 0.0.0) are skipped, and with no readable version the old 0.0.0 fallback applies. All seven bumpable targets read the same files they bump:

  • npm: package.json
  • pypi: static version in pyproject.toml (none for setuptools_scm, whose version comes from tags)
  • crates: Cargo.toml
  • gem: the gemspec, or lib/**/version.rb when the gemspec uses a constant
  • pub-dev: pubspec.yaml
  • hex: mix.exs
  • nuget: Directory.Build.props, then *.csproj

The bump regexes in pypi, gem, and hex moved to module constants so reading and bumping use the same pattern. PEP 440 versions that aren't valid semver (e.g. 1.0.0a1) are skipped.

This also applies to repos without workspaces: an untagged repo, or one checked out without its tags, now bumps from its targets' project files instead of 0.0.0.

Open question: the second half of #946, letting --workspace cli resolve to packages/cli so workflows don't need a case mapping, isn't in this PR. Matching on the directory basename has an ambiguity question (two globs can each yield a cli) that seems worth deciding on its own.

--

View Session in Sentry

…rsion

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-11-01 16:24 UTC

Comment thread src/commands/prepare.ts Resolved
@sentry-junior sentry-junior Bot changed the title feat(prepare): Bump untagged release units from their package.json version feat(prepare): Bump untagged release units from their project files' version Nov 1, 2026
@BYK
BYK marked this pull request as ready for review November 1, 2026 16:06

@cursor cursor Bot 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.

Stale Bugbot comment from a previous run.

Comment thread src/targets/nuget.ts Resolved

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c71749b. Configure here.

Comment thread src/targets/nuget.ts Resolved
@BYK
BYK merged commit f9d5834 into master Nov 1, 2026
29 checks passed
@BYK
BYK deleted the feat/bump-from-manifest-version branch November 1, 2026 16:23
sentry-junior Bot added a commit to getsentry/toolkit that referenced this pull request Nov 2, 2026
The Release workflow bumped the version in package.json itself, with
`semver -i`. package.json holds the next `-dev` version, so a patch from
`0.48.0-dev.0` gave `0.48.0` instead of `0.47.1`.

Pass the bump type to `craft prepare` instead. Since Craft 3.6.0
(getsentry/craft#947) it bumps from the workspace's latest release tag
(`cli@0.47.0` gives patch 0.47.1, minor 0.48.0, major 1.0.0), and before
the first tag from the version in package.json (logger `1.0.0-dev.0`
gives 1.0.0 for any bump).

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
false — 8db99d51 Deployed Nov 1, 2026 by sentry-junior[bot] via Build #3265
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.

1 participant