Skip to content

chore(release): migrate from Lerna to Changesets#585

Merged
petermuessig merged 3 commits into
UI5:mainfrom
petermuessig:chore/migrate-to-changesets
Jun 5, 2026
Merged

chore(release): migrate from Lerna to Changesets#585
petermuessig merged 3 commits into
UI5:mainfrom
petermuessig:chore/migrate-to-changesets

Conversation

@petermuessig
Copy link
Copy Markdown
Contributor

Summary

Replaces Lerna with Changesets for versioning and publishing. The release flow now mirrors what's in use in ui5-community/ui5-ecosystem-showcase: contributors add a .changeset/*.md to their PR, merging to main opens/updates a Version Packages PR, and merging that PR publishes to npm.

What changed

File Change
.changeset/config.json, .changeset/README.md New — independent versioning, GitHub changelog, ignores private @ui5/openui5-snapshot-test and @ui5/typed-json-model
scripts/auto-changeset.mjs New — derives .changeset/auto-<sha>.md files from conventional commits (scope -> packages, type -> bump). Idempotent; hand-written changesets always win
.github/workflows/release.yml Rewritten to use changesets/action@v1.8.0 with npm OIDC trusted publishing + provenance, fallback to NPM_BOOTSTRAP_TOKEN
.github/workflows/changeset.yml New — PR gate that fails when no changeset is present. Counts .changesets rather than .releases so empty changesets pass
package.json Removed lerna, added @changesets/cli + @changesets/changelog-github. Replaced release:* scripts with changeset / version-packages / release-publish / changeset:auto / changeset:empty. build is now explicit per workspace (the test-packages have no build script)
CONTRIBUTING.md Rewritten end-to-end: PR checklist, three-command picker for changesets, bump-derivation table, maintainer release flow. Legal / DCO / AI-generated-code sections preserved
lerna.json Deleted
yarn.lock Refreshed

New contributor flow

# In your feature branch:
yarn changeset:auto       # walk conventional commits and write .changeset/auto-*.md (recommended)
yarn changeset            # interactive picker, when auto-derived bump/summary is wrong
yarn changeset:empty      # docs/CI-only PRs that don't need a release entry

New release flow (no local lerna, no push-to-main, no npm creds)

  1. Merge a PR with at least one changeset to main.
  2. The Release workflow opens/updates a single Version Packages PR (versions bumped, CHANGELOGs regenerated, lockfile refreshed).
  3. Merge that PR.
  4. The same workflow publishes the new versions to npm with provenance and pushes the matching tags.

Verification

  • yarn install — ok, lockfile updated cleanly
  • yarn build — both @ui5/dts-generator and @ui5/ts-interface-generator compile (incl. api-extractor)
  • yarn changeset status — exit 0 (no pending changesets, expected)
  • yarn changeset versionNo unreleased changesets found, exiting (expected)
  • node scripts/auto-changeset.mjs --dry-run --verbose — range resolved against last chore(release): publish commit, 0 commits since
  • yarn format:validate — clean

Not in this PR (intentional)

  • Yarn classic stays for now. A pnpm migration is a logical follow-up (the showcase uses pnpm; pnpm install --lockfile-only is a cleaner fit for the version-packages step than yarn classic), but it's a separate diff worth reviewing on its own.
  • The informational Package "@ui5/openui5-snapshot-test" must depend on the current version of "@ui5/dts-generator" warnings from changeset status are harmless under yarn classic's link: syntax. They go away with the pnpm migration.

Required follow-up before merging

  • Confirm secrets.NPM_BOOTSTRAP_TOKEN is configured on UI5/typescript (or that npm OIDC trusted publishing is set up for @ui5/dts-generator and @ui5/ts-interface-generator).
  • After merging, the first push to main will open an empty Version Packages PR — that's expected.

@petermuessig petermuessig requested a review from akudev June 2, 2026 11:26
Replace Lerna with Changesets for versioning and publishing:

- Add .changeset/ config + README pointing at UI5/typescript; ignore the
  private test-packages so changeset publish skips them automatically
- Add scripts/auto-changeset.mjs to derive changesets from conventional
  commits (scope -> packages, type -> bump, subject -> summary)
- Rewrite .github/workflows/release.yml to use changesets/action@v1.8.0:
  opens/updates a 'Version Packages' PR on main, then publishes on merge
  with npm OIDC trusted publishing + provenance, falling back to
  NPM_BOOTSTRAP_TOKEN when OIDC isn't configured
- Add .github/workflows/changeset.yml as a PR gate that fails when no
  changeset is present (counts .changesets so empty changesets pass)
- Replace root release:* lerna scripts with changeset / version-packages
  / release-publish; build is now explicit per workspace because the
  test-packages have no build script
- Remove lerna and lerna.json; add @changesets/cli +
  @changesets/changelog-github devDependencies
- Rewrite CONTRIBUTING.md to document the new flow end-to-end while
  preserving the existing Legal / DCO / AI-generated-code sections
@petermuessig petermuessig force-pushed the chore/migrate-to-changesets branch from 8c4c24b to 273d63a Compare June 2, 2026 11:30
@petermuessig petermuessig requested a review from codeworrior June 2, 2026 13:15
@petermuessig
Copy link
Copy Markdown
Contributor Author

@codeworrior @akudev - here is the change to get rid of the local release steps and make this part of GH actions by using changesets - I can also explain to you how this new release flow will work.

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

Migrates the monorepo release tooling from Lerna to Changesets, introducing an automated release PR + publish workflow and a PR gate to require changesets for all incoming changes.

Changes:

  • Replace Lerna-based versioning/publishing scripts with Changesets CLI workflows and scripts.
  • Add scripts/auto-changeset.mjs to derive .changeset/*.md entries from conventional commits.
  • Add GitHub Actions workflows for release automation and PR-level changeset enforcement; update contributor documentation accordingly.

Reviewed changes

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

Show a summary per file
File Description
scripts/auto-changeset.mjs New helper CLI to generate changesets from conventional commits.
package.json Removes Lerna scripts/dependency; adds Changesets scripts and deps.
lerna.json Removed (Lerna no longer used).
CONTRIBUTING.md Rewrites contribution + release guidance to the new Changesets flow.
.github/workflows/release.yml Reworks release automation to use changesets/action.
.github/workflows/changeset.yml New PR workflow to require a changeset (including empty changesets).
.changeset/config.json Adds Changesets configuration (independent versioning, GitHub changelog, ignores).
.changeset/README.md Adds repo-specific Changesets documentation.
.changeset/fresh-cobras-send.md Adds an empty changeset entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/release.yml Outdated
Comment thread .github/workflows/release.yml Outdated
Comment thread CONTRIBUTING.md Outdated
Comment thread .changeset/README.md Outdated
Comment thread scripts/auto-changeset.mjs
@akudev
Copy link
Copy Markdown
Member

akudev commented Jun 5, 2026

Edge case, but skip-if-covered drops uncovered packages:

const overlap = pkgNames.filter((n) => covered.has(n));
if (overlap.length > 0) {
    return { skip: `already covered (${overlap.join(", ")})` };
}

If a hand-written changeset already covers @ui5/dts-generator and a subsequent commit touches both @ui5/dts-generator and @ui5/ts-interface-generator, the entire commit is skipped — missing the ts-interface-generator change. The fix would be to filter out the covered packages and proceed with the uncovered ones:

const uncovered = pkgNames.filter((n) => !covered.has(n));
if (uncovered.length === 0) {
    return { skip: `already covered (${pkgNames.join(", ")})` };
}
// continue with uncovered instead of pkgNames

petermuessig and others added 2 commits June 5, 2026 12:05
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@petermuessig petermuessig force-pushed the chore/migrate-to-changesets branch from 2098f91 to fa2d157 Compare June 5, 2026 10:07
@petermuessig petermuessig merged commit 31bba60 into UI5:main Jun 5, 2026
7 checks passed
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.

3 participants