Skip to content

build(release): filter release commits by package path - #556

Merged
romanlamsal merged 1 commit into
mainfrom
build/semantic-release-monorepo
Sep 30, 2026
Merged

romanlamsal merged 1 commit into
mainfrom
build/semantic-release-monorepo

Conversation

@romanlamsal

Copy link
Copy Markdown
Contributor

Problem

Each package runs its own semantic-release, but semantic-release analyzes every commit since the package's last tag, regardless of which files it touched. The workflow paths: filters only decide when a release job runs, not which commits count. That's how #555 (.github/ only) triggered release components, which picked up #554's fix(components-map): … and published @swr-data-lab/components@4.0.1 with no changes to components.

Fix

Both packages now extend semantic-release-monorepo (8.0.2), which limits analyzeCommits/generateNotes to commits that changed a file inside the package folder (git diff-tree). The explicit tagFormat in each package.json overrides the plugin's default (@swr-data-lab/<pkg>-v${version}), so existing components-v* / components-map-v* tags keep working.

Verification

Dry runs against a local bare clone of this repo (no GitHub/npm involved), with components-v4.0.1 removed to replay the #555 situation:

Scenario Before After
components after #554 + #555 2 commits → 4.0.1 (the bogus release) 1 of 3 commits (this one, build:) → no release
components-map after #555 – 1 of 2 commits → no release
synthetic fix: in components/src only – components → 4.0.1, tag components-v4.0.1
synthetic feat: in components-map/src only – components-map → 1.1.0, tag components-map-v1.1.0

Merging this runs both release workflows (it touches both package.jsons); both should report no release, since this is a build: commit.

Caveats

  • The plugin's last release was Feb 2024; its peer range (semantic-release >=22.0.7) covers 25, and the dry runs above ran on 25.0.8.
  • Commits that only touch files outside a package folder (e.g. the root package-lock.json) no longer release that package.
  • Release notes label versions as @swr-data-lab/<pkg>-v…; nothing publishes the notes today (no GitHub release/changelog plugin).

🤖 Generated with Claude Code

semantic-release analyzed every commit since a package's last tag,
regardless of which files it touched. The components-map fix in #554
therefore also released @swr-data-lab/components@4.0.1 when #555
triggered the components workflow.

Both packages now extend semantic-release-monorepo, which limits
analyzeCommits and generateNotes to commits that changed files inside
the package folder. The explicit tagFormat keeps the existing
components-v* / components-map-v* tags (the plugin's default would be
@swr-data-lab/<pkg>-v*).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@romanlamsal
romanlamsal merged commit 8fe3310 into main Sep 30, 2026
2 checks passed
@romanlamsal
romanlamsal deleted the build/semantic-release-monorepo branch September 30, 2026 21:06
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