Skip to content

Commit ecac042

Browse files
authored
ci: add unified release workflow removing npm access token (#12644)
1 parent 90ca4a9 commit ecac042

File tree

1 file changed

+155
-9
lines changed

1 file changed

+155
-9
lines changed

.github/workflows/release.yaml

Lines changed: 155 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,167 @@
11
name: Release Stable Version
22

33
on:
4+
# Manual releases
45
workflow_dispatch:
6+
inputs:
7+
release_type:
8+
description: 'Release Type'
9+
required: true
10+
type: choice
11+
options:
12+
- 'rc'
13+
- 'stable'
14+
- 'hotfix'
15+
- 'experimental'
16+
default: 'rc'
17+
version_bump:
18+
description: 'Version Bump (stable only: patch|minor|major or auto)'
19+
required: false
20+
default: ''
21+
npm_tag:
22+
description: 'NPM tag'
23+
required: false
24+
default: 'sf'
25+
26+
# Scheduled automatic RC releases
27+
schedule:
28+
- cron: "00 08 * * THU" # Thursdays at 8 AM UTC
29+
530

631
jobs:
32+
# Job : Version and Build
733
build-and-release:
8-
runs-on: ubuntu-latest
934
permissions:
1035
contents: write
1136
id-token: write
1237
issues: write
38+
pull-requests: write
39+
pages: write
40+
runs-on: ubuntu-latest
41+
outputs:
42+
version: ${{ steps.version-output.outputs.version }}
1343
steps:
14-
- uses: actions/checkout@v4
15-
with:
16-
token: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
17-
fetch-depth: 0
18-
- uses: actions/[email protected]
19-
with:
20-
node-version: 22
21-
cache: 'yarn'
44+
# Checkout and Prepare
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
with:
48+
token: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
49+
fetch-depth: 0
50+
51+
- name: Setup Node
52+
uses: actions/[email protected]
53+
with:
54+
node-version: 22
55+
cache: 'yarn'
56+
57+
- name: Install Dependencies
58+
run: yarn --frozen-lockfile
59+
60+
# Conditional Version Bump
61+
62+
- name: Version Bump - Stable
63+
if: ${{ github.event.inputs.release_type == 'stable' }}
64+
env:
65+
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
66+
run: |
67+
npm config set //registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}
68+
git config user.name "${{ secrets.UI5_WEBCOMP_BOT_NAME }}"
69+
git config user.email "${{ secrets.UI5_WEBCOMP_BOT_EMAIL }}"
70+
yarn lerna version --conventional-graduate --force-conventional-graduate --yes --exact --create-release github
71+
72+
- name: Version Bump - RC
73+
if: ${{ github.event.inputs.release_type == 'rc' }}
74+
env:
75+
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
76+
run: |
77+
npm config set //registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}
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 Bump - Hotfix
83+
if: ${{ github.event.inputs.release_type == 'hotfix' }}
84+
env:
85+
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
86+
run: |
87+
git config user.name "${{ secrets.UI5_WEBCOMP_BOT_NAME }}"
88+
git config user.email "${{ secrets.UI5_WEBCOMP_BOT_EMAIL }}"
89+
yarn lerna version ${{ github.event.inputs.version_bump || '' }} --conventional-graduate --force-conventional-graduate --yes --exact --create-release github
90+
91+
# Build
92+
- name: Build
93+
run: yarn ci:releasebuild
94+
95+
# Output new version
96+
- name: Output Version
97+
id: version-output
98+
run: |
99+
VERSION=$(node -p "require('./lerna.json').version")
100+
echo "version=$VERSION" >> $GITHUB_OUTPUT
101+
102+
# Conditional NPM Publish
103+
- name: Publish Stable
104+
if: ${{ github.event.inputs.release_type == 'stable'}}
105+
env:
106+
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
107+
run: |
108+
yarn lerna publish from-git --yes
109+
110+
- name: Merge Release Changelog
111+
if: ${{ github.event.inputs.release_type == 'stable' }}
112+
uses: actions/github-script@v7
113+
env:
114+
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
115+
with:
116+
github-token: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
117+
script: |
118+
const mergeReleaseChangelog = (await import('${{ github.workspace }}/.github/actions/mergeReleaseChangelog.mjs')).default;
119+
await mergeReleaseChangelog({ github , context });
120+
121+
- name: Publish RC
122+
if: ${{ github.event.inputs.release_type == 'rc'}}
123+
env:
124+
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
125+
run: |
126+
yarn lerna publish from-git --yes
127+
128+
- name: Publish Experimental
129+
if: ${{ github.event.inputs.release_type == 'experimental' }}
130+
run: |
131+
node ./.github/actions/release.cjs
132+
133+
- name: Publish Hotfix
134+
if: ${{ github.event.inputs.release_type == 'hotfix' }}
135+
env:
136+
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
137+
run: yarn lerna publish from-git --yes --dist-tag ${{ github.event.inputs.npm_tag }}
138+
139+
140+
# Conditional Deploy
141+
# Deploy RC
142+
- name: Pre-Deploy RC
143+
if: ${{ github.event.inputs.release_type == 'rc'}}
144+
run: |
145+
yarn ci:deploy:nightly
146+
147+
- name: Deploy RC
148+
if: ${{ github.event.inputs.release_type == 'rc'}}
149+
uses: JamesIves/[email protected]
150+
with:
151+
branch: gh-pages # The branch the action should deploy to.
152+
folder: packages/website/build # The folder the action should deploy.
153+
target-folder: nightly
154+
clean: true
155+
156+
# Release Comments
157+
- name: Publish Release Comments
158+
if: ${{ github.event.inputs.release_type == 'stable' }} || ${{ github.event.inputs.release_type == 'rc'}}
159+
uses: actions/github-script@v7
160+
env:
161+
NODE_OPTIONS: '--max-old-space-size=12096'
162+
GH_TOKEN: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
163+
with:
164+
github-token: ${{ secrets.UI5_WEBCOMP_BOT_GH_TOKEN }}
165+
script: |
166+
const commentOnFixedIssues = (await import('${{ github.workspace }}/.github/actions/commentOnFixedIssues.mjs')).default;
167+
await commentOnFixedIssues({ github, context });

0 commit comments

Comments
 (0)