Skip to content

Commit 7a674bb

Browse files
authored
[build] Pre-release workflow improvements (#16946)
* [build] allow running pre-release with just major and minor versions specified * [build] pre-release does not need ruby installed * [build] have pre-release get latest from trunk before updating files * [build] have pre-release workflow automatically request and lock trunk
1 parent 4907723 commit 7a674bb

File tree

2 files changed

+83
-9
lines changed

2 files changed

+83
-9
lines changed

.github/workflows/get-approval.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Get Approval
2+
3+
permissions: {}
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
title:
9+
description: 'Notification title'
10+
required: true
11+
type: string
12+
message:
13+
description: 'Notification message'
14+
required: true
15+
type: string
16+
secrets:
17+
SLACK_WEBHOOK_URL:
18+
required: true
19+
20+
jobs:
21+
notify:
22+
name: Send Notification
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Slack Notification
26+
uses: rtCamp/action-slack-notify@v2
27+
env:
28+
SLACK_ICON_EMOJI: ":key:"
29+
SLACK_COLOR: warning
30+
SLACK_CHANNEL: selenium-tlc
31+
SLACK_USERNAME: GitHub Workflows
32+
SLACK_TITLE: ${{ inputs.title }}
33+
SLACK_MESSAGE: ${{ inputs.message }}
34+
MSG_MINIMAL: actions url
35+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
36+
37+
authorize:
38+
name: Authorize
39+
needs: notify
40+
runs-on: ubuntu-latest
41+
environment: production
42+
steps:
43+
- name: Approved
44+
run: echo "Approved"

.github/workflows/pre-release.yml

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ permissions:
1919
contents: read
2020

2121
jobs:
22+
get-approval:
23+
name: Get Approval
24+
uses: ./.github/workflows/get-approval.yml
25+
with:
26+
title: Release approval needed
27+
message: |
28+
Selenium ${{ github.event.inputs.version }} release preparation started.
29+
Please approve to lock trunk when ready.
30+
secrets:
31+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
32+
33+
# Rust jobs run in parallel with approval since work is not on trunk
2234
update-rust:
2335
name: Update Rust Version
2436
runs-on: ubuntu-latest
@@ -82,10 +94,18 @@ jobs:
8294
run: |
8395
git push origin --delete rust-release-${{ github.event.inputs.version }}
8496
97+
restrict-trunk:
98+
name: Restrict Trunk Branch
99+
needs: [get-approval, selenium-manager]
100+
uses: ./.github/workflows/restrict-trunk.yml
101+
with:
102+
restrict: true
103+
secrets: inherit
104+
85105
update-files:
86106
name: Update Files
87107
runs-on: ubuntu-latest
88-
needs: selenium-manager
108+
needs: restrict-trunk
89109
steps:
90110
- name: "Checkout project"
91111
uses: actions/checkout@v4
@@ -94,11 +114,8 @@ jobs:
94114
fetch-depth: 0
95115
fetch-tags: true
96116
ref: trunk
97-
- name: Install Ruby
98-
uses: ruby/setup-ruby@v1
99-
with:
100-
ruby-version: '3.2'
101-
working-directory: 'rb'
117+
- name: Get latest trunk
118+
run: git pull --ff-only origin trunk
102119
- name: Setup curl for Ubuntu
103120
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
104121
- name: Setup Bazel
@@ -116,6 +133,19 @@ jobs:
116133
run: |
117134
git config --local user.email "[email protected]"
118135
git config --local user.name "Selenium CI Bot"
136+
- name: Normalize version
137+
id: version
138+
shell: bash
139+
run: |
140+
VERSION="${{ github.event.inputs.version }}"
141+
VERSION="${VERSION//[[:space:]]/}"
142+
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then
143+
VERSION="${VERSION}.0"
144+
elif [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
145+
echo "::error::Invalid version format: '$VERSION'. Expected major.minor or major.minor.patch"
146+
exit 1
147+
fi
148+
echo "value=$VERSION" >> "$GITHUB_OUTPUT"
119149
- name: Update browser versions
120150
id: browsers
121151
run: |
@@ -168,7 +198,7 @@ jobs:
168198
fi
169199
- name: Bump versions
170200
run: |
171-
./go all:version ${{ github.event.inputs.version }}
201+
./go all:version ${{ steps.version.outputs.value }}
172202
git commit -m "bump versions in preparation for release"
173203
- name: Update changelogs
174204
run: |
@@ -180,9 +210,9 @@ jobs:
180210
token: ${{ secrets.SELENIUM_CI_TOKEN }}
181211
author: Selenium CI Bot <[email protected]>
182212
delete-branch: true
183-
branch: release-preparation-${{ github.event.inputs.version }}
213+
branch: release-preparation-${{ steps.version.outputs.value }}
184214
base: trunk
185-
title: "[build] Prepare for release of Selenium ${{ github.event.inputs.version }}"
215+
title: "[build] Prepare for release of Selenium ${{ steps.version.outputs.value }}"
186216
body: |
187217
188218
### Updates Applied

0 commit comments

Comments
 (0)