Skip to content

Commit 4b99646

Browse files
committed
[ci] Create a PR for node/standalone changelog
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent a396474 commit 4b99646

File tree

4 files changed

+88
-19
lines changed

4 files changed

+88
-19
lines changed

.github/workflows/release-chrome-versions.yml

Lines changed: 70 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,49 @@ on:
2222
description: 'Build date in format YYYYMMDD. Must provide if reusing base image'
2323
required: false
2424
type: string
25-
default: ''
25+
default: '20250123'
2626
browser-name:
2727
description: 'Browser name to build. E.g: chrome'
2828
required: true
2929
type: string
3030
default: 'chrome'
31-
browser-version:
32-
description: 'Browser version to build. E.g: 120'
31+
browser-versions:
32+
description: 'List browser version to build. E.g: [130, 131]'
3333
required: true
34-
type: string
34+
default: '[109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132]'
3535
push-image:
3636
description: 'Push image after testing successfully'
3737
required: true
3838
type: boolean
39+
default: false
40+
pr-changelog:
41+
description: 'Create a PR for CHANGELOG'
42+
required: true
43+
type: boolean
3944
default: true
4045

4146
env:
4247
GRID_VERSION: ${{ github.event.inputs.grid-version }}
4348
BROWSER_NAME: ${{ github.event.inputs.browser-name }}
44-
BROWSER_VERSION: ${{ github.event.inputs.browser-version }}
4549
REUSE_BASE: ${{ github.event.inputs.reuse-base || true }}
4650
BUILD_DATE: ${{ github.event.inputs.build-date || '' }}
4751
NAMESPACE: ${{ vars.DOCKER_NAMESPACE || 'selenium' }}
4852
AUTHORS: ${{ vars.AUTHORS || 'SeleniumHQ' }}
4953
PUSH_IMAGE: ${{ github.event.inputs.push-image || false }}
54+
PR_CHANGELOG: ${{ github.event.inputs.pr-changelog || true }}
55+
RUN_ID: ${{ github.run_id }}
5056

5157
jobs:
5258
deploy:
53-
name: Deploy Node/Standalone Chrome with specific browser version
59+
name: Deploy Node/Standalone Chrome
5460
runs-on: ubuntu-24.04
5561
permissions: write-all
62+
strategy:
63+
fail-fast: false
64+
matrix:
65+
browser-version: ${{ fromJSON(github.event.inputs.browser-versions)}}
66+
outputs:
67+
GRID_VERSION: ${{ steps.display_grid_version.outputs.GRID_VERSION }}
5668
steps:
5769
- name: Checkout code
5870
uses: actions/checkout@main
@@ -81,13 +93,19 @@ jobs:
8193
echo "BUILD_DATE=${BUILD_DATE}" >> $GITHUB_ENV
8294
fi
8395
echo "NAME=${NAMESPACE}" >> $GITHUB_ENV
96+
echo "BROWSER_VERSION=${BROWSER_VERSION}" >> $GITHUB_ENV
97+
env:
98+
BROWSER_VERSION: ${{ matrix.browser-version }}
8499
- name: Get Grid version
85100
if: env.GRID_VERSION == ''
86101
run: |
87102
echo ${BASE_VERSION}
88103
echo "GRID_VERSION=${BASE_VERSION}" >> $GITHUB_ENV
89104
- name: Display Grid version
90-
run: echo ${GRID_VERSION}
105+
id: display_grid_version
106+
run: |
107+
echo ${GRID_VERSION}
108+
echo "GRID_VERSION=${GRID_VERSION}" >> "$GITHUB_OUTPUT"
91109
- name: Login Docker Hub
92110
run: docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
93111
env:
@@ -114,3 +132,48 @@ jobs:
114132
name: image_tags_${{ env.GRID_VERSION }}_${{ env.BROWSER_NAME }}_${{ env.BROWSER_VERSION }}
115133
path: ./CHANGELOG/${{ env.GRID_VERSION }}/${{ env.BROWSER_NAME }}_${{ env.BROWSER_VERSION }}.md
116134
if-no-files-found: ignore
135+
136+
pr-results:
137+
name: Create a PR with changelog
138+
if: (!failure() && !cancelled() && (github.event.inputs.pr-changelog == 'true'))
139+
runs-on: ubuntu-24.04
140+
needs: deploy
141+
steps:
142+
- name: Checkout code
143+
uses: actions/checkout@main
144+
with:
145+
persist-credentials: false
146+
fetch-depth: 0
147+
- name: Get Grid version
148+
run: |
149+
echo "GRID_VERSION=${GRID_VERSION}" >> $GITHUB_ENV
150+
env:
151+
GRID_VERSION: ${{ needs.deploy.outputs.GRID_VERSION }}
152+
- name: Download results
153+
uses: actions/download-artifact@v4
154+
with:
155+
path: ./CHANGELOG/${{ env.GRID_VERSION }}
156+
pattern: 'image_tags_*'
157+
merge-multiple: 'true'
158+
run-id: ${{ env.RUN_ID }}
159+
github-token: ${{ secrets.GITHUB_TOKEN }}
160+
- name: Commit configs
161+
run: |
162+
git config --local user.email "[email protected]"
163+
git config --local user.name "Selenium CI Bot"
164+
- name: Create Pull Request
165+
id: cpr
166+
uses: peter-evans/create-pull-request@main
167+
with:
168+
token: ${{ secrets.SELENIUM_CI_TOKEN }}
169+
commit-message: "[ci] Upload CHANGELOG for Node/Standalone ${{ env.BROWSER_NAME }} version with Grid ${{ env.GRID_VERSION }}"
170+
title: "[ci] Upload CHANGELOG for Node/Standalone ${{ env.BROWSER_NAME }} version with Grid ${{ env.GRID_VERSION }}"
171+
body: "This PR contains the CHANGELOG for Node/Standalone Chrome with specific browser versions: ${{ github.event.inputs.browser-versions }}"
172+
committer: 'Selenium CI Bot <[email protected]>'
173+
author: 'Selenium CI Bot <[email protected]>'
174+
branch: browser-node-changelog
175+
- name: Check outputs
176+
if: ${{ steps.cpr.outputs.pull-request-number }}
177+
run: |
178+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
179+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

tests/build-backward-compatible/bootstrap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ IFS=',' read -ra VERSION_LIST <<< "$CDP_VERSIONS"
2525
mkdir -p CHANGELOG/${SELENIUM_VERSION}
2626

2727
for CDP_VERSION in "${VERSION_LIST[@]}"; do
28-
python3 tests/build-backward-compatible/builder.py ${SELENIUM_VERSION} ${CDP_VERSION}
28+
python3 tests/build-backward-compatible/builder.py ${SELENIUM_VERSION} ${CDP_VERSION} ${BROWSER}
2929
export $(cat .env | xargs)
3030
if [ "${BROWSER}" = "all" ] || [ "${BROWSER}" = "firefox" ] && [ "${SKIP_BUILD}" = "false" ]; then
3131
if [ -n "${FIREFOX_VERSION}" ]; then

tests/build-backward-compatible/builder.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,23 @@ def recursive_merge(dict1, dict2):
3030
# Get versions from arguments
3131
selenium_version = sys.argv[1]
3232
cdp_version = int(sys.argv[2])
33+
browser_name = sys.argv[3]
3334
# Create .env with component versions
34-
BASE_RELEASE = matrix["selenium"][selenium_version]["BASE_RELEASE"]
35-
BASE_VERSION = matrix["selenium"][selenium_version]["BASE_VERSION"]
36-
VERSION = matrix["selenium"][selenium_version]["VERSION"]
37-
BINDING_VERSION = matrix["selenium"][selenium_version]["BINDING_VERSION"]
38-
FIREFOX_VERSION = matrix["CDP"][cdp_version]["FIREFOX_VERSION"]
39-
EDGE_VERSION = matrix["CDP"][cdp_version]["EDGE_VERSION"]
40-
CHROME_VERSION = matrix["CDP"][cdp_version]["CHROME_VERSION"]
4135
with open('.env', 'w') as f:
42-
f.write(f"BASE_RELEASE={BASE_RELEASE}\n")
43-
f.write(f"BASE_VERSION={BASE_VERSION}\n")
44-
f.write(f"VERSION={VERSION}\n")
45-
f.write(f"BINDING_VERSION={BINDING_VERSION}\n")
36+
BASE_RELEASE = matrix["selenium"][selenium_version]["BASE_RELEASE"]
37+
BASE_VERSION = matrix["selenium"][selenium_version]["BASE_VERSION"]
38+
VERSION = matrix["selenium"][selenium_version]["VERSION"]
39+
BINDING_VERSION = matrix["selenium"][selenium_version]["BINDING_VERSION"]
40+
f.write(f"BASE_RELEASE={BASE_RELEASE}\n")
41+
f.write(f"BASE_VERSION={BASE_VERSION}\n")
42+
f.write(f"VERSION={VERSION}\n")
43+
f.write(f"BINDING_VERSION={BINDING_VERSION}\n")
44+
if browser_name == "firefox" or browser_name == "all":
45+
FIREFOX_VERSION = matrix["CDP"][cdp_version]["FIREFOX_VERSION"]
4646
f.write(f"FIREFOX_VERSION={FIREFOX_VERSION}\n")
47+
if browser_name == "edge" or browser_name == "all":
48+
EDGE_VERSION = matrix["CDP"][cdp_version]["EDGE_VERSION"]
4749
f.write(f"EDGE_VERSION={EDGE_VERSION}\n")
50+
if browser_name == "chrome" or browser_name == "all":
51+
CHROME_VERSION = matrix["CDP"][cdp_version]["CHROME_VERSION"]
4852
f.write(f"CHROME_VERSION={CHROME_VERSION}")

tests/build-backward-compatible/cdp-matrix.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,5 @@ matrix:
100100
EDGE_VERSION: 'microsoft-edge-stable=110.0.1587.69-1'
101101
CHROME_VERSION: 'google-chrome-stable=110.0.5481.177-1'
102102
FIREFOX_VERSION: '110.0.1'
103+
109:
104+
CHROME_VERSION: 'google-chrome-stable=109.0.5414.119-1'

0 commit comments

Comments
 (0)