forked from UI5/webcomponents-react
-
Notifications
You must be signed in to change notification settings - Fork 0
216 lines (186 loc) · 6.56 KB
/
Copy pathrelease.yml
File metadata and controls
216 lines (186 loc) · 6.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: 'Release'
# This workflow handles all release flows for the monorepo.
#
# Auto release (push to main):
# Release Please opens/updates a release PR with version bumps + changelog.
# When a maintainer merges that PR, the publish job ships every package to
# npm via OIDC trusted publishing, then the MCP registry publish chains.
#
# Manual dispatch:
# - mode = snapshot → bump to 0.0.0-<sha>, publish to npm dist-tag `dev`. Any branch.
# - mode = publish-only → publish current packages/*/package.json versions as-is.
# Recovery for a stable release whose publish job died after
# Release Please created the tag. Restricted to main.
on:
push:
branches: [main]
workflow_dispatch:
inputs:
mode:
type: choice
description: 'What to publish'
options:
- snapshot
- publish-only
default: snapshot
permissions: {}
jobs:
release-please:
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
outputs:
releases_created: ${{ steps.rp.outputs.releases_created }}
tag_name: ${{ steps.rp.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
id: rp
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
publish:
needs: release-please
if: needs.release-please.outputs.releases_created == 'true'
runs-on: ubuntu-latest
environment:
name: 'npm'
url: 'https://www.npmjs.com/package/@ui5/webcomponents-react'
permissions:
contents: write
id-token: write
issues: write
pull-requests: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup Node.js environment
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install
run: |
npm install -g npm
yarn install --immutable
- name: build
run: yarn build
- name: build mcp-server data
run: yarn build:mcp
- name: publish to npm
run: ${GITHUB_WORKSPACE}/node_modules/.bin/lerna publish from-package --yes
env:
NPM_CONFIG_PROVENANCE: true
- name: Add release comments to issues and PRs
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { default: addIssueComments } = await import('${{ github.workspace }}/.github/createIssueCommentsForRelease.mjs');
await addIssueComments({ github, context })
snapshot:
if: github.event_name == 'workflow_dispatch' && inputs.mode == 'snapshot'
runs-on: ubuntu-latest
environment:
name: 'npm'
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup Node.js environment
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install
run: |
npm install -g npm
yarn install --immutable
# Mutates package.json in the runner only; no commit, no tag — snapshot is ephemeral.
- name: version - Snapshot
run: |
git_hash=$(git rev-parse --short "${{ github.sha }}")
${GITHUB_WORKSPACE}/node_modules/.bin/lerna version "0.0.0-${git_hash}" \
--exact \
--no-push \
--no-git-tag-version \
--yes \
--allow-branch ${{ github.ref_name }}
- name: build
run: yarn build
- name: build mcp-server data
run: yarn build:mcp
- name: publish to npm
run: ${GITHUB_WORKSPACE}/node_modules/.bin/lerna publish from-package --yes --dist-tag dev
env:
NPM_CONFIG_PROVENANCE: true
publish-only:
if: github.event_name == 'workflow_dispatch' && inputs.mode == 'publish-only' && github.ref_name == 'main'
runs-on: ubuntu-latest
environment:
name: 'npm'
url: 'https://www.npmjs.com/package/@ui5/webcomponents-react'
permissions:
contents: write
id-token: write
issues: write
pull-requests: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup Node.js environment
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install
run: |
npm install -g npm
yarn install --immutable
- name: build
run: yarn build
- name: build mcp-server data
run: yarn build:mcp
- name: publish to npm
run: ${GITHUB_WORKSPACE}/node_modules/.bin/lerna publish from-package --yes
env:
NPM_CONFIG_PROVENANCE: true
- name: Add release comments to issues and PRs
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { default: addIssueComments } = await import('${{ github.workspace }}/.github/createIssueCommentsForRelease.mjs');
await addIssueComments({ github, context })
# snapshots intentionally excluded (not main; no production release).
publish-mcp-registry:
needs: [publish, publish-only]
if: |
always() && github.ref_name == 'main' &&
(needs.publish.result == 'success' || needs.publish-only.result == 'success')
uses: './.github/workflows/publish-mcp-registry.yml'
permissions:
id-token: write
contents: read
deploy-docs-stable:
needs: [publish, publish-only]
if: |
github.ref_name == 'main' &&
(needs.publish.result == 'success' || needs.publish-only.result == 'success')
uses: './.github/workflows/docs-stable.yml'
permissions:
pages: write
id-token: write
contents: write