11name : ' 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+
316on :
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
0 commit comments