Skip to content

Commit ef7f722

Browse files
authored
[build] unlock trunk once the release finishes writing to it (#17938)
* [build] unlock trunk once the release finishes writing to it * [build] skip the grid nightly release when the nightly build was skipped * [build] skip the commit when the patch has already been applied * [build] keep the standalone unlock notification since the summary arrives much later * [build] keep trunk locked when a release write to trunk fails
1 parent 6df5706 commit ef7f722

5 files changed

Lines changed: 54 additions & 24 deletions

File tree

‎.github/rulesets/release-require-passing.json‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,11 @@
3737
}
3838
}
3939
],
40-
"bypass_actors": []
40+
"bypass_actors": [
41+
{
42+
"actor_id": 19032128,
43+
"actor_type": "Team",
44+
"bypass_mode": "always"
45+
}
46+
]
4147
}

‎.github/rulesets/release-restrict-trunk.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
"actor_id": 7157452,
2424
"actor_type": "Team",
2525
"bypass_mode": "always"
26+
},
27+
{
28+
"actor_id": 19032128,
29+
"actor_type": "Team",
30+
"bypass_mode": "always"
2631
}
2732
]
2833
}

‎.github/workflows/commit-changes.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ jobs:
4848
git config --local user.email "[email protected]"
4949
git config --local user.name "Selenium CI Bot"
5050
if [ -s changes.patch ]; then
51+
if git apply --reverse --check changes.patch 2>/dev/null; then
52+
echo "::notice::Patch already applied on this branch; skipping commit and push."
53+
exit 0
54+
fi
5155
git apply --index changes.patch
5256
rm -f changes.patch
5357
git commit -m "$COMMIT_MESSAGE"

‎.github/workflows/nightly.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
release-grid:
8181
name: Release Grid
8282
needs: [prepare, nightly-release]
83-
if: always() && needs.prepare.outputs.artifact-name
83+
if: always() && needs.prepare.outputs.artifact-name && needs.nightly-release.result != 'skipped'
8484
runs-on: ubuntu-latest
8585
permissions:
8686
contents: write

‎.github/workflows/release.yml‎

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -261,25 +261,23 @@ jobs:
261261

262262
verify:
263263
name: Verify Published Packages
264-
needs: [parse-tag, docs]
264+
needs: [parse-tag, publish, publish-python]
265+
if: >-
266+
always() && !cancelled() &&
267+
needs.publish.result == 'success' &&
268+
(needs.publish-python.result == 'success' || needs.publish-python.result == 'skipped')
265269
uses: ./.github/workflows/bazel.yml
266270
with:
267271
name: Verify packages
268272
run: ./go ${{ needs.parse-tag.outputs.language }}:verify
269273

270-
unrestrict-trunk:
271-
name: Unrestrict Trunk Branch
272-
needs: verify
273-
uses: ./.github/workflows/restrict-trunk.yml
274-
with:
275-
restrict: false
276-
secrets:
277-
SELENIUM_CI_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }}
278-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
279-
280274
reset-version:
281275
name: Generate Nightly Versions
282-
needs: [parse-tag, docs]
276+
needs: [parse-tag, publish, publish-python]
277+
if: >-
278+
always() && !cancelled() &&
279+
needs.publish.result == 'success' &&
280+
(needs.publish-python.result == 'success' || needs.publish-python.result == 'skipped')
283281
uses: ./.github/workflows/bazel.yml
284282
with:
285283
name: Reset Versions
@@ -288,7 +286,7 @@ jobs:
288286

289287
update-version:
290288
name: Push Nightly Versions
291-
needs: [parse-tag, reset-version, unrestrict-trunk]
289+
needs: [parse-tag, reset-version]
292290
permissions:
293291
contents: write
294292
actions: read
@@ -301,7 +299,7 @@ jobs:
301299

302300
nightly:
303301
name: Publish Nightly Packages
304-
needs: [parse-tag, update-version]
302+
needs: [parse-tag, unrestrict-trunk]
305303
permissions:
306304
contents: write
307305
packages: write
@@ -312,26 +310,42 @@ jobs:
312310

313311
mirror:
314312
name: Update Release Mirror
315-
needs: [parse-tag, nightly]
313+
needs: [parse-tag, update-version]
316314
if: needs.parse-tag.outputs.language == 'all'
317315
uses: ./.github/workflows/mirror-selenium-releases.yml
318316
secrets: inherit
319317

320-
on-release-failure:
321-
name: On Release Failure
318+
unrestrict-trunk:
319+
name: Unrestrict Trunk Branch
320+
needs: [parse-tag, publish, publish-python, update-version, mirror]
321+
if: >-
322+
always() && !cancelled() &&
323+
needs.publish.result == 'success' &&
324+
(needs.publish-python.result == 'success' || needs.publish-python.result == 'skipped') &&
325+
needs.update-version.result == 'success' &&
326+
(needs.mirror.result == 'success' || needs.mirror.result == 'skipped')
327+
uses: ./.github/workflows/restrict-trunk.yml
328+
with:
329+
restrict: false
330+
secrets:
331+
SELENIUM_CI_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }}
332+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
333+
334+
on-release-complete:
335+
name: On Release Complete
322336
runs-on: ubuntu-latest
323-
needs: [publish, publish-python, docs, create-tag, github-release-draft, github-release-publish, update-version, nightly, mirror, verify]
324-
if: failure()
337+
needs: [publish, publish-python, docs, create-tag, github-release-draft, github-release-publish, reset-version, update-version, nightly, mirror, verify, unrestrict-trunk]
338+
if: always() && !cancelled()
325339
steps:
326340
- uses: actions/checkout@v6
327341
- name: Slack Notification
328342
uses: rtCamp/action-slack-notify@v2
329343
env:
330-
SLACK_ICON_EMOJI: ":rotating_light:"
331-
SLACK_COLOR: failure
344+
SLACK_ICON_EMOJI: ${{ contains(needs.*.result, 'failure') && ':rotating_light:' || (needs.publish.result == 'success' && ':white_check_mark:' || ':warning:') }}
345+
SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || (needs.publish.result == 'success' && 'good' || 'warning') }}
332346
SLACK_CHANNEL: selenium-tlc
333347
SLACK_USERNAME: GitHub Workflows
334-
SLACK_TITLE: Release failed
348+
SLACK_TITLE: ${{ contains(needs.*.result, 'failure') && 'Release failed' || (needs.publish.result == 'success' && 'Release complete' || 'Release did not run') }}
335349
SLACK_MESSAGE: |
336350
• Selenium Published: ${{ needs.publish.result }}
337351
• Python Published: ${{ needs.publish-python.result }}
@@ -343,5 +357,6 @@ jobs:
343357
• Nightly Packages: ${{ needs.nightly.result }}
344358
• Mirror Updated: ${{ needs.mirror.result }}
345359
• Packages Verified: ${{ needs.verify.result }}
360+
• Trunk Unlocked: ${{ needs.unrestrict-trunk.result }}
346361
MSG_MINIMAL: actions url
347362
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)