Skip to content

fix(prepare): Run automatic version bumps in the selected workspace - #938

Merged
BYK merged 1 commit into
masterfrom
fix/workspace-version-bump-dir
Oct 27, 2026
Merged

BYK merged 1 commit into
masterfrom
fix/workspace-version-bump-dir

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

With release workspaces, the automatic version bump (no preReleaseCommand) ran from the directory containing .craft.yml. For an npm target in a pnpm monorepo, releasing one workspace bumped every non-private package in the root pnpm-workspace.yaml.

craft prepare now passes the selected workspace's directory to the automatic bumps, so every bumpable target (npm, pypi, crates, nuget, ...) reads project files from that workspace. Workspaces that are not directories (aliases like cli) keep using the config directory, the same rule the workspace changelog default already uses. That directory check is shared through a new getReleaseUnitDir() helper.

Custom preReleaseCommands and publish-time target expansion (workspaces: true on npm or nuget) do not change. NuGet documents solutionPath as relative to the repo root, so changing expansion would be a separate, breaking decision.

Fixes #936

via @BYK.

--

View Junior Session [Sentry]

Fixes #936

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

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-27 22:05 UTC

@BYK
BYK merged commit 2d8180c into master Oct 27, 2026
29 checks passed
@BYK
BYK deleted the fix/workspace-version-bump-dir branch October 27, 2026 22:05
BYK added a commit that referenced this pull request Oct 27, 2026
…ings (#939)

A glob release-workspace key gave every matched directory identical
settings, so independently released packages each needed a near-copy
literal entry that only differed by name (`tagPrefix`,
`releaseBranchPrefix`, status contexts, artifact names, ...).

String settings now expand placeholders for the selected workspace when
the config is resolved:

- `{{workspace}}`: the workspace path (`static/packages/scraps`)
- `{{workspaceName}}`: its basename (`scraps`)
- `{{packageName}}` / `{{packageSimpleName}}`: from the workspace's
`package.json` (`@sentry/scraps` / `sentry-scraps`). Craft reads it only
when one of these is used, and fails if the file or `name` is missing.

Expansion covers inherited top-level settings too, so a top-level
default like `releaseBranchPrefix: '{{workspaceName}}/release'` works
for every workspace.

The issue proposed `{{simpleName}}`. I used `{{packageSimpleName}}`
because the npm target's `artifactTemplate` already uses `{{name}}`,
`{{simpleName}}`, and `{{version}}` per package workspace, and expanding
those at config time would break them. Unknown `{{...}}` markers are
left alone.

Combined with #938 (#936), a single `static/packages/*` entry can
replace the three literal entries in getsentry/sentry, including the
custom `preReleaseCommand`.

Fixes #937

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0CACQ70E8Z%3A1793137484.145799 -->

--

[View Junior
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0CACQ70E8Z%3A1793137484.145799)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0CACQ70E8Z%3A1793137484.145799/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Burak Yigit Kaya <126780+BYK@users.noreply.github.com>
BYK added a commit that referenced this pull request Oct 27, 2026
…ace (#940)

Follow-up to #938. With a release workspace selected, a NuGet target
with `workspaces: true` still expanded every packable project in the
solution, so releasing one workspace would publish all of them.

Expansion now keeps only the projects inside the selected workspace's
directory. The solution is still read from the repository root, so
`solutionPath` keeps its documented meaning, and auto-discovery still
looks there. This matches getsentry/sentry-dotnet: a single root
`Sentry.slnx` lists `src/Sentry`, `src/Sentry.Maui`, and so on, so a
`src/Sentry.Maui` workspace expands to just `Sentry.Maui`. The new tests
use the existing `msbuild-solution` fixture, which has the same layout.

The workspace filter runs before
`includeWorkspaces`/`excludeWorkspaces`. If no packable project is
inside the workspace, Craft fails with a configuration error. Workspaces
that are not directories (aliases) and configs without workspaces behave
as before. `expandWorkspaceTargets` passes the release unit directory to
every expandable target as a third argument. Only NuGet uses it for now;
npm expansion does not change.

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0CACQ70E8Z%3A1793137484.145799 -->

--

[View Junior
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0CACQ70E8Z%3A1793137484.145799)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0CACQ70E8Z%3A1793137484.145799/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Burak Yigit Kaya <126780+BYK@users.noreply.github.com>
sentry-junior Bot added a commit to getsentry/sentry that referenced this pull request Oct 27, 2026
Craft 3.3.0 expands workspace placeholders and runs the automatic version
bump in the selected workspace (getsentry/craft#938, #939). Replace the
three literal static/packages entries with one static/packages/* entry,
drop the custom preReleaseCommands, and fold the three pack workflows
into one that derives the package from the release branch.

The resolved Craft config for scraps, icons and search-syntax is
unchanged apart from the artifact workflow name and the dropped
preReleaseCommand. Bump the release workflow's Craft action to 3.3.0
and minVersion to match.

This branch was previously deployed

1 inactive deployment
false — 812d586b Deployed Oct 27, 2026 by sentry-junior[bot] via Build #3235
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.

Automatic version bump ignores the selected release workspace

1 participant