Skip to content

Commit 3b84336

Browse files
authored
refactor(ci): migrate from lerna to release-please (#8675)
1 parent 6c17d65 commit 3b84336

10 files changed

Lines changed: 183 additions & 159 deletions

.github/createIssueCommentsForRelease.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const commitShaRegExp = /commit\/(?<sha>\w{40})/gm;
1111
* @returns {Promise<void>}
1212
*/
1313
export default async function run({ github, context }) {
14-
const { version } = JSON.parse(readFileSync(new URL('../lerna.json', import.meta.url)).toString());
14+
const { version } = JSON.parse(readFileSync(new URL('../packages/main/package.json', import.meta.url)).toString());
1515

1616
const { data: release } = await github.request('GET /repos/{owner}/{repo}/releases/tags/{tag}', {
1717
owner: context.repo.owner,

.github/workflows/docs-stable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
- name: Get Major Version
3232
run: |
33-
MAJOR_VERSION=$(node -p -e "/^(\d+)\./.exec(require('./lerna.json').version)[1]")
33+
MAJOR_VERSION=$(node -p -e "/^(\d+)\./.exec(require('./packages/main/package.json').version)[1]")
3434
echo "MAJOR_VERSION=${MAJOR_VERSION}" >> "$GITHUB_ENV"
3535
3636
- name: Build Storybook

.github/workflows/release-comments.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 114 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,64 @@
11
name: 'Release'
22

3+
# This workflow handles all release flows for the monorepo.
4+
#
5+
# Auto release (push to main):
6+
# Release Please opens/updates a release PR with version bumps + changelog.
7+
# When a maintainer merges that PR, the publish job ships every package to
8+
# npm via OIDC trusted publishing, then the MCP registry publish chains.
9+
#
10+
# Manual dispatch:
11+
# - mode = snapshot → bump to 0.0.0-<sha>, publish to npm dist-tag `dev`. Any branch.
12+
# - mode = publish-only → publish current packages/*/package.json versions as-is.
13+
# Recovery for a stable release whose publish job died after
14+
# Release Please created the tag. Restricted to main.
15+
316
on:
17+
push:
18+
branches: [main]
419
workflow_dispatch:
520
inputs:
6-
release_type:
7-
type: string
8-
description: 'Release Type: Lerna Auto Versioning if empty.'
9-
required: false
10-
default: ''
11-
prerelease:
12-
type: boolean
13-
description: 'pre-release'
14-
required: false
15-
default: false
16-
snapshot:
17-
type: boolean
18-
description: 'Release as snapshot. This setting has precedence over all other inputs.'
19-
required: false
20-
default: false
21-
publish_only:
22-
type: boolean
23-
description: 'Skip versioning and only publish existing tags to npm. Use when a previous release failed during publish.'
24-
required: false
25-
default: false
21+
mode:
22+
type: choice
23+
description: 'What to publish'
24+
options:
25+
- snapshot
26+
- publish-only
27+
default: snapshot
2628

27-
jobs:
28-
build:
29-
if: ${{ github.event.inputs.publish_only != 'true' }}
30-
permissions:
31-
contents: read
32-
uses: './.github/workflows/build.yml'
29+
permissions: {}
3330

34-
test:
35-
if: ${{ github.event.inputs.publish_only != 'true' }}
36-
needs: ['build']
31+
jobs:
32+
release-please:
33+
if: github.event_name == 'push'
34+
runs-on: ubuntu-latest
3735
permissions:
38-
contents: read
36+
contents: write
3937
pull-requests: write
40-
checks: write
41-
uses: './.github/workflows/test.yml'
42-
with:
43-
reportCoverage: false
38+
issues: write
39+
outputs:
40+
releases_created: ${{ steps.rp.outputs.releases_created }}
41+
tag_name: ${{ steps.rp.outputs.tag_name }}
42+
steps:
43+
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
44+
id: rp
45+
with:
46+
token: ${{ secrets.GITHUB_TOKEN }}
47+
config-file: release-please-config.json
48+
manifest-file: .release-please-manifest.json
4449

45-
release-dryrun:
46-
if: ${{ github.event.inputs.publish_only != 'true' }}
50+
publish:
51+
needs: release-please
52+
if: needs.release-please.outputs.releases_created == 'true'
4753
runs-on: ubuntu-latest
54+
environment:
55+
name: 'npm'
56+
url: 'https://www.npmjs.com/package/@ui5/webcomponents-react'
4857
permissions:
49-
contents: read
58+
contents: write
59+
id-token: write
60+
issues: write
61+
pull-requests: write
5062
steps:
5163
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
5264
with:
@@ -63,40 +75,37 @@ jobs:
6375
npm install -g npm
6476
yarn install --immutable
6577
66-
- name: version - Release
67-
if: ${{ github.event.inputs.snapshot == 'false' }}
68-
run: |
69-
${GITHUB_WORKSPACE}/node_modules/.bin/lerna version ${{ github.event.inputs.release_type }} \
70-
${{ (github.event.inputs.prerelease == 'true' && '--conventional-prerelease') || '--conventional-graduate' }} \
71-
--no-push \
72-
--no-git-tag-version
78+
- name: build
79+
run: yarn build
7380

74-
- name: version - Snapshot
75-
if: ${{ github.event.inputs.snapshot == 'true' }}
76-
run: |
77-
git_hash=$(git rev-parse --short "${{ github.sha }}")
81+
- name: build mcp-server data
82+
run: yarn build:mcp
7883

79-
${GITHUB_WORKSPACE}/node_modules/.bin/lerna version "0.0.0-${git_hash}" \
80-
--exact \
81-
--no-push \
82-
--no-git-tag-version \
83-
--allow-branch ${{ github.ref_name }}
84+
- name: publish to npm
85+
run: ${GITHUB_WORKSPACE}/node_modules/.bin/lerna publish from-package --yes
86+
env:
87+
NPM_CONFIG_PROVENANCE: true
8488

85-
build-and-release:
86-
if: ${{ !cancelled() && (github.event.inputs.publish_only == 'true' || (needs.test.result == 'success' && needs.release-dryrun.result == 'success')) }}
87-
needs: ['test', 'release-dryrun']
89+
- name: Add release comments to issues and PRs
90+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
91+
with:
92+
github-token: ${{ secrets.GITHUB_TOKEN }}
93+
script: |
94+
const { default: addIssueComments } = await import('${{ github.workspace }}/.github/createIssueCommentsForRelease.mjs');
95+
96+
await addIssueComments({ github, context })
97+
98+
snapshot:
99+
if: github.event_name == 'workflow_dispatch' && inputs.mode == 'snapshot'
88100
runs-on: ubuntu-latest
89101
environment:
90102
name: 'npm'
91-
url: 'https://www.npmjs.com/package/@ui5/webcomponents-react'
92103
permissions:
93-
contents: write
104+
contents: read
94105
id-token: write
95-
issues: write
96106
steps:
97107
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
98108
with:
99-
token: ${{ secrets.ACCESS_TOKEN }}
100109
fetch-depth: 0
101110

102111
- name: Setup Node.js environment
@@ -105,38 +114,21 @@ jobs:
105114
node-version-file: '.nvmrc'
106115
cache: 'yarn'
107116

108-
- name: Install and build
117+
- name: Install
109118
run: |
110119
npm install -g npm
111120
yarn install --immutable
112121
113-
- name: List packages to publish
114-
if: ${{ github.event.inputs.publish_only == 'true' }}
115-
run: ${GITHUB_WORKSPACE}/node_modules/.bin/lerna ls --json
116-
117-
- name: Setup Git User
118-
if: ${{ github.event.inputs.publish_only != 'true' }}
119-
run: |
120-
git config user.email ${{ vars.BOT_GIT_EMAIL }}
121-
git config user.name ${{ vars.BOT_GIT_USERNAME }}
122-
123-
- name: version - Release
124-
if: ${{ github.event.inputs.publish_only != 'true' && github.event.inputs.snapshot == 'false' }}
125-
run: |
126-
${GITHUB_WORKSPACE}/node_modules/.bin/lerna version ${{ github.event.inputs.release_type }} \
127-
${{ (github.event.inputs.prerelease == 'true' && '--conventional-prerelease') || '--conventional-graduate' }} \
128-
--create-release github
129-
env:
130-
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
131-
122+
# Mutates package.json in the runner only; no commit, no tag — snapshot is ephemeral.
132123
- name: version - Snapshot
133-
if: ${{ github.event.inputs.publish_only != 'true' && github.event.inputs.snapshot == 'true' }}
134124
run: |
135125
git_hash=$(git rev-parse --short "${{ github.sha }}")
136126
137127
${GITHUB_WORKSPACE}/node_modules/.bin/lerna version "0.0.0-${git_hash}" \
138128
--exact \
139129
--no-push \
130+
--no-git-tag-version \
131+
--yes \
140132
--allow-branch ${{ github.ref_name }}
141133
142134
- name: build
@@ -146,37 +138,63 @@ jobs:
146138
run: yarn build:mcp
147139

148140
- name: publish to npm
149-
if: ${{ github.event.inputs.publish_only != 'true' }}
150-
run: |
151-
${GITHUB_WORKSPACE}/node_modules/.bin/lerna publish from-git ${{ (github.event.inputs.snapshot == 'true' && '--pre-dist-tag dev') || '' }}
141+
run: ${GITHUB_WORKSPACE}/node_modules/.bin/lerna publish from-package --yes --dist-tag dev
152142
env:
153-
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
154143
NPM_CONFIG_PROVENANCE: true
155144

156-
- name: publish to npm (from-package)
157-
if: ${{ github.event.inputs.publish_only == 'true' }}
145+
publish-only:
146+
if: github.event_name == 'workflow_dispatch' && inputs.mode == 'publish-only' && github.ref_name == 'main'
147+
runs-on: ubuntu-latest
148+
environment:
149+
name: 'npm'
150+
url: 'https://www.npmjs.com/package/@ui5/webcomponents-react'
151+
permissions:
152+
contents: write
153+
id-token: write
154+
issues: write
155+
pull-requests: write
156+
steps:
157+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
158+
with:
159+
fetch-depth: 0
160+
161+
- name: Setup Node.js environment
162+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
163+
with:
164+
node-version-file: '.nvmrc'
165+
cache: 'yarn'
166+
167+
- name: Install
158168
run: |
159-
${GITHUB_WORKSPACE}/node_modules/.bin/lerna publish from-package
169+
npm install -g npm
170+
yarn install --immutable
171+
172+
- name: build
173+
run: yarn build
174+
175+
- name: build mcp-server data
176+
run: yarn build:mcp
177+
178+
- name: publish to npm
179+
run: ${GITHUB_WORKSPACE}/node_modules/.bin/lerna publish from-package --yes
160180
env:
161-
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
162181
NPM_CONFIG_PROVENANCE: true
163182

164-
### Semantic Release Bot comments for issues and PRs ###
165183
- name: Add release comments to issues and PRs
166184
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
167-
if: ${{ github.event.inputs.snapshot == 'false' }}
168-
env:
169-
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
170185
with:
171-
github-token: ${{ secrets.ACCESS_TOKEN }}
186+
github-token: ${{ secrets.GITHUB_TOKEN }}
172187
script: |
173188
const { default: addIssueComments } = await import('${{ github.workspace }}/.github/createIssueCommentsForRelease.mjs');
174189
175190
await addIssueComments({ github, context })
176191
192+
# snapshots intentionally excluded (not main; no production release).
177193
publish-mcp-registry:
178-
needs: ['build-and-release']
179-
if: ${{ github.event.inputs.snapshot == 'false' && github.event.inputs.prerelease == 'false' }}
194+
needs: [publish, publish-only]
195+
if: |
196+
always() && github.ref_name == 'main' &&
197+
(needs.publish.result == 'success' || needs.publish-only.result == 'success')
180198
uses: './.github/workflows/publish-mcp-registry.yml'
181199
permissions:
182200
id-token: write

.pipeline/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ general:
44
buildTool: yarn
55
steps:
66
artifactPrepareVersion:
7-
filePath: 'lerna.json'
7+
filePath: 'packages/main/package.json'
88
versioningType: 'library'
99
customVersionField: 'version'
1010

.release-please-manifest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"packages/main": "2.22.2",
3+
"packages/base": "2.22.2",
4+
"packages/charts": "2.22.2",
5+
"packages/cli": "2.22.2",
6+
"packages/compat": "2.22.2",
7+
"packages/ai": "2.22.2",
8+
"packages/cypress-commands": "2.22.2",
9+
"packages/mcp-server": "2.22.2"
10+
}

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Change Log
22

3+
> **This file is preserved as a historical archive up to v2.22.2.** Newer release notes are published per-package in `packages/*/CHANGELOG.md` and aggregated on the [GitHub Releases page](https://github.com/UI5/webcomponents-react/releases).
4+
35
All notable changes to this project will be documented in this file.
46
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
57

lerna.json

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3-
"version": "2.22.2",
4-
"npmClient": "yarn",
5-
"command": {
6-
"version": {
7-
"allowBranch": "main",
8-
"conventionalCommits": true,
9-
"yes": true,
10-
"preid": "rc",
11-
"message": "chore(release): publish %s [ci skip]",
12-
"forceConventionalGraduate": true
13-
},
14-
"publish": {
15-
"allowBranch": "main",
16-
"conventionalCommits": true,
17-
"yes": true,
18-
"preid": "rc",
19-
"preDistTag": "next",
20-
"message": "chore(release): publish %s [ci skip]"
21-
}
22-
}
3+
"version": "independent",
4+
"npmClient": "yarn"
235
}

0 commit comments

Comments
 (0)