Skip to content

Commit 2c875c3

Browse files
authored
chore: refactor release workflow for improved clarity
Refactor release workflow to streamline version bumping and publishing processes for stable, RC, hotfix, and experimental releases. Add new jobs for RC and hotfix releases, and remove redundant steps.
1 parent e79c39b commit 2c875c3

File tree

1 file changed

+148
-91
lines changed

1 file changed

+148
-91
lines changed

.github/workflows/release.yaml

Lines changed: 148 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,17 @@ on:
2929
schedule:
3030
- cron: "00 08 * * THU" # Thursdays at 8 AM UTC
3131

32-
3332
jobs:
34-
# Job : Version and Build
35-
build-and-release:
33+
# ✅ Job 1: Stable Release Flow
34+
stable-release:
35+
if: ${{ github.event.inputs.release_type == 'stable' }}
3636
permissions:
3737
contents: write
3838
id-token: write
3939
issues: write
4040
pull-requests: write
41-
pages: write
4241
runs-on: ubuntu-latest
43-
outputs:
44-
version: ${{ steps.version-output.outputs.version }}
4542
steps:
46-
# Checkout and Prepare
4743
- name: Checkout
4844
uses: actions/checkout@v4
4945
with:
@@ -59,92 +55,22 @@ jobs:
5955
- name: Install Dependencies
6056
run: yarn --frozen-lockfile
6157

62-
# Conditional Version Bump
63-
64-
- name: Version - Stable
65-
if: ${{ github.event.inputs.release_type == 'stable' }}
66-
env:
67-
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
68-
run: |
69-
git config user.name "${{ secrets.UI5_WEBCOMP_BOT_NAME }}"
70-
git config user.email "${{ secrets.UI5_WEBCOMP_BOT_EMAIL }}"
71-
yarn lerna version ${{ github.event.inputs.new_version || '' }} --conventional-graduate --force-conventional-graduate --yes --exact --create-release github
72-
73-
- name: Version - RC
74-
if: ${{ github.event.inputs.release_type == 'rc' }}
75-
env:
76-
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
77-
run: |
78-
git config user.name "${{ secrets.UI5_WEBCOMP_BOT_NAME }}"
79-
git config user.email "${{ secrets.UI5_WEBCOMP_BOT_EMAIL }}"
80-
yarn lerna version --conventional-prerelease --force-publish --yes --exact --create-release github
81-
82-
- name: Version - Hotfix
83-
if: ${{ github.event.inputs.release_type == 'hotfix' }}
58+
- name: Version Bump
8459
env:
8560
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
8661
run: |
8762
git config user.name "${{ secrets.UI5_WEBCOMP_BOT_NAME }}"
8863
git config user.email "${{ secrets.UI5_WEBCOMP_BOT_EMAIL }}"
8964
yarn lerna version ${{ github.event.inputs.new_version || '' }} --conventional-graduate --force-conventional-graduate --yes --exact --create-release github
9065
91-
- name: Version - Experimental
92-
if: ${{ github.event.inputs.release_type == 'experimental' }}
93-
run: |
94-
git config user.name "${{ secrets.UI5_WEBCOMP_BOT_NAME }}"
95-
git config user.email "${{ secrets.UI5_WEBCOMP_BOT_EMAIL }}"
96-
git_hash=$(git rev-parse --short "${{ github.sha }}")
97-
yarn lerna version "0.0.0-${git_hash}" \
98-
--exact \
99-
--no-push \
100-
--yes \
101-
--allow-branch ${{ github.ref_name }} \
102-
--ignore-changes @ui5/webcomponents-website \
103-
--ignore-changes @ui5/webcomponents-cypress-internal \
104-
--ignore-changes @ui5/webcomponents-cypress-ct \
105-
106-
# Build
10766
- name: Build
10867
run: yarn ci:releasebuild
10968

110-
# Output new version
111-
- name: Output Version
112-
id: version-output
113-
run: |
114-
VERSION=$(node -p "require('./lerna.json').version")
115-
echo "version=$VERSION" >> $GITHUB_OUTPUT
116-
117-
# Conditional NPM Publish
118-
- name: Publish - Stable
119-
if: ${{ github.event.inputs.release_type == 'stable'}}
120-
env:
121-
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
122-
run: |
123-
yarn lerna publish from-git --yes
124-
125-
- name: Publish - RC
126-
if: ${{ github.event.inputs.release_type == 'rc'}}
127-
env:
128-
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
69+
- name: Publish to NPM
12970
run: |
13071
yarn lerna publish from-git --yes
13172
132-
- name: Publish - Hotfix
133-
if: ${{ github.event.inputs.release_type == 'hotfix' }}
134-
env:
135-
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
136-
run: yarn lerna publish from-git --yes --dist-tag ${{ github.event.inputs.npm_tag }}
137-
138-
- name: Publish - Experimental
139-
if: ${{ github.event.inputs.release_type == 'experimental' }}
140-
env:
141-
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
142-
run: |
143-
yarn lerna publish from-git --yes --dist-tag experimental
144-
145-
# Changelog
14673
- name: Merge Release Changelog
147-
if: ${{ github.event.inputs.release_type == 'stable' }}
14874
uses: actions/github-script@v7
14975
env:
15076
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
@@ -153,26 +79,72 @@ jobs:
15379
script: |
15480
const mergeReleaseChangelog = (await import('${{ github.workspace }}/.github/actions/mergeReleaseChangelog.mjs')).default;
15581
await mergeReleaseChangelog({ github , context });
156-
157-
# Conditional Deploy
158-
# Deploy RC
159-
- name: Pre-Deploy RC
160-
if: ${{ github.event.inputs.release_type == 'rc'}}
82+
83+
- name: Publish Release Comments
84+
uses: actions/github-script@v7
85+
env:
86+
NODE_OPTIONS: '--max-old-space-size=12096'
87+
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
88+
with:
89+
github-token: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
90+
script: |
91+
const commentOnFixedIssues = (await import('${{ github.workspace }}/.github/actions/commentOnFixedIssues.mjs')).default;
92+
await commentOnFixedIssues({ github, context });
93+
94+
# ✅ Job 2: RC Release Flow
95+
rc-release:
96+
if: ${{ github.event.inputs.release_type == 'rc' || github.event_name == 'schedule' }}
97+
permissions:
98+
contents: write
99+
id-token: write
100+
issues: write
101+
pull-requests: write
102+
pages: write
103+
runs-on: ubuntu-latest
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@v4
107+
with:
108+
token: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
109+
fetch-depth: 0
110+
111+
- name: Setup Node
112+
uses: actions/[email protected]
113+
with:
114+
node-version: 22
115+
cache: 'yarn'
116+
117+
- name: Install Dependencies
118+
run: yarn --frozen-lockfile
119+
120+
- name: Version Bump
121+
env:
122+
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
123+
run: |
124+
git config user.name "${{ secrets.UI5_WEBCOMP_BOT_NAME }}"
125+
git config user.email "${{ secrets.UI5_WEBCOMP_BOT_EMAIL }}"
126+
yarn lerna version --conventional-prerelease --force-publish --yes --exact --create-release github
127+
128+
- name: Build
129+
run: yarn ci:releasebuild
130+
131+
- name: Publish to NPM
132+
run: |
133+
yarn lerna publish from-git --yes
134+
135+
- name: Pre-Deploy
161136
run: |
162137
yarn ci:deploy:nightly
163-
164-
- name: Deploy RC
165-
if: ${{ github.event.inputs.release_type == 'rc'}}
138+
139+
- name: Deploy to GitHub Pages
166140
uses: JamesIves/[email protected]
167141
with:
168-
branch: gh-pages # The branch the action should deploy to.
169-
folder: packages/website/build # The folder the action should deploy.
142+
branch: gh-pages
143+
folder: packages/website/build
170144
target-folder: nightly
171145
clean: true
172146

173-
# Release Comments
174147
- name: Publish Release Comments
175-
if: ${{ github.event.inputs.release_type == 'stable' || github.event.inputs.release_type == 'rc' }}
176148
uses: actions/github-script@v7
177149
env:
178150
NODE_OPTIONS: '--max-old-space-size=12096'
@@ -182,3 +154,88 @@ jobs:
182154
script: |
183155
const commentOnFixedIssues = (await import('${{ github.workspace }}/.github/actions/commentOnFixedIssues.mjs')).default;
184156
await commentOnFixedIssues({ github, context });
157+
158+
# ✅ Job 3: Hotfix Release Flow
159+
hotfix-release:
160+
if: ${{ github.event.inputs.release_type == 'hotfix' }}
161+
permissions:
162+
contents: write
163+
id-token: write
164+
issues: write
165+
pull-requests: write
166+
runs-on: ubuntu-latest
167+
steps:
168+
- name: Checkout
169+
uses: actions/checkout@v4
170+
with:
171+
token: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
172+
fetch-depth: 0
173+
174+
- name: Setup Node
175+
uses: actions/[email protected]
176+
with:
177+
node-version: 22
178+
cache: 'yarn'
179+
180+
- name: Install Dependencies
181+
run: yarn --frozen-lockfile
182+
183+
- name: Version Bump
184+
env:
185+
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
186+
run: |
187+
git config user.name "${{ secrets.UI5_WEBCOMP_BOT_NAME }}"
188+
git config user.email "${{ secrets.UI5_WEBCOMP_BOT_EMAIL }}"
189+
yarn lerna version ${{ github.event.inputs.new_version || '' }} --conventional-graduate --force-conventional-graduate --yes --exact --create-release github
190+
191+
- name: Build
192+
run: yarn ci:releasebuild
193+
194+
- name: Publish to NPM
195+
run: yarn lerna publish from-git --yes --dist-tag ${{ github.event.inputs.npm_tag || 'sf' }}
196+
197+
# ✅ Job 4: Experimental Release Flow
198+
experimental-release:
199+
if: ${{ github.event.inputs.release_type == 'experimental' }}
200+
permissions:
201+
contents: write
202+
id-token: write
203+
runs-on: ubuntu-latest
204+
steps:
205+
- name: Checkout
206+
uses: actions/checkout@v4
207+
with:
208+
token: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
209+
fetch-depth: 0
210+
211+
- name: Setup Node
212+
uses: actions/[email protected]
213+
with:
214+
node-version: 22
215+
cache: 'yarn'
216+
217+
- name: Install Dependencies
218+
run: yarn --frozen-lockfile
219+
220+
- name: Version Bump
221+
env:
222+
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
223+
run: |
224+
git config user.name "${{ secrets.UI5_WEBCOMP_BOT_NAME }}"
225+
git config user.email "${{ secrets.UI5_WEBCOMP_BOT_EMAIL }}"
226+
git_hash=$(git rev-parse --short "${{ github.sha }}")
227+
yarn lerna version "0.0.0-${git_hash}" \
228+
--exact \
229+
--no-push \
230+
--yes \
231+
--allow-branch ${{ github.ref_name }} \
232+
--ignore-changes @ui5/webcomponents-website \
233+
--ignore-changes @ui5/webcomponents-cypress-internal \
234+
--ignore-changes @ui5/webcomponents-cypress-ct
235+
236+
- name: Build
237+
run: yarn ci:releasebuild
238+
239+
- name: Publish to NPM
240+
run: |
241+
yarn lerna publish from-git --yes --dist-tag experimental

0 commit comments

Comments
 (0)