blob: 0eb196aeb98de2a8b61d8eb600df0c8456089b81 [file] [edit]
name: Release - Start
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., selenium-4.28.0 or selenium-4.28.1-ruby)'
required: true
permissions:
contents: read
jobs:
parse-tag:
name: Parse Tag
uses: ./.github/workflows/parse-release-tag.yml
with:
tag: ${{ inputs.tag }}
generate-rust-version:
name: Generate Rust Version
needs: [parse-tag, verify-cdp]
if: github.event.repository.fork == false && needs.parse-tag.outputs.language == 'all'
uses: ./.github/workflows/upload-changes.yml
with:
name: Update Rust version
run: ./go rust:version ${{ needs.parse-tag.outputs.version }}
artifact-name: rust-version
push-rust-version:
name: Push Rust Version
needs: [parse-tag, generate-rust-version]
permissions:
contents: write
actions: read
uses: ./.github/workflows/commit-changes.yml
with:
artifact-name: rust-version
commit-message: "update selenium manager version and rust changelog"
push-branch: rust-release-${{ needs.parse-tag.outputs.version }}
secrets:
SELENIUM_CI_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }}
selenium-manager:
name: Release Selenium Manager
needs: [parse-tag, push-rust-version]
permissions:
contents: write
actions: read
uses: ./.github/workflows/sm-snapshot.yml
with:
branch: rust-release-${{ needs.parse-tag.outputs.version }}
secrets:
SELENIUM_CI_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }}
cleanup-rust-branch:
name: Cleanup Rust Branch
needs: [parse-tag, selenium-manager]
if: always()
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v6
with:
token: ${{ secrets.SELENIUM_CI_TOKEN }}
- name: Delete rust release branch
run: |
git push origin --delete rust-release-${{ needs.parse-tag.outputs.version }} || true
verify-cdp:
name: Verify CDP is Current
needs: parse-tag
runs-on: ubuntu-latest
steps:
- name: Checkout the DevTools listing
uses: actions/checkout@v6
with:
sparse-checkout: |
common/devtools/chromium
scripts/github-actions
persist-credentials: false
- name: Verify CDP covers the current Stable Chrome
if: needs.parse-tag.outputs.language == 'all'
run: ./scripts/github-actions/verify_cdp.sh
restrict-trunk:
name: Restrict Trunk Branch
needs: [parse-tag, verify-cdp]
uses: ./.github/workflows/restrict-trunk.yml
with:
message: |
Trunk branch has been restricted for release preparation (${{ inputs.tag }}).
To abandon the release, close the release preparation PR without merging and trunk will unlock automatically.
If trunk is still locked, run the "Release - Lock and Unlock Trunk" workflow, which unlocks by default:
https://github.com/${{ github.repository }}/actions/workflows/restrict-trunk.yml
secrets:
SELENIUM_CI_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
# ci and ci-rbe workflows wait while trunk is locked so RBE capacity and macOS runners stay free for the release.
# This cancels in-progress workflows & restarts them so they are also queued.
requeue-ci:
name: Requeue CI Behind Lock
needs: restrict-trunk
runs-on: ubuntu-latest
continue-on-error: true
timeout-minutes: 5
env:
GH_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }}
GH_REPO: ${{ github.repository }}
steps:
- name: Cancel and rerun in-flight CI runs
run: |
mapfile -t ids < <(for workflow in ci.yml ci-rbe.yml; do for state in queued in_progress; do
gh run list --workflow "$workflow" --status "$state" --limit 100 --json databaseId,headBranch \
--jq '.[] | select(.headBranch | startswith("release-preparation-") | not) | .databaseId'
done; done)
cancelled=()
for id in "${ids[@]}"; do gh run cancel "$id" && cancelled+=("$id"); done
for id in "${cancelled[@]}"; do
gh run watch "$id" > /dev/null && gh run rerun "$id" || echo "::warning::Run $id was cancelled but could not be rerun"
done
update-versions:
name: Bump Versions
needs: [parse-tag, restrict-trunk]
uses: ./.github/workflows/upload-changes.yml
with:
name: Bump versions
run: ./go ${{ needs.parse-tag.outputs.language }}:version ${{ needs.parse-tag.outputs.version }}${{ needs.parse-tag.outputs.language == 'all' && format(' && ./go rust:version {0}', needs.parse-tag.outputs.version) || '' }}
artifact-name: patch-versions
commit-versions:
name: Commit Versions
needs: [parse-tag, update-versions]
permissions:
contents: write
actions: read
uses: ./.github/workflows/commit-changes.yml
with:
artifact-name: patch-versions
commit-message: "bump versions"
push-branch: staging/release-${{ needs.parse-tag.outputs.tag }}
secrets:
SELENIUM_CI_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }}
update-changelogs:
name: Generate Changelogs
needs: [parse-tag, commit-versions]
uses: ./.github/workflows/upload-changes.yml
with:
name: Update changelogs
ref: staging/release-${{ needs.parse-tag.outputs.tag }}
run: ./scripts/github-actions/deepen-fetch-to-tag.sh ${{ needs.parse-tag.outputs.tag }} && ./go ${{ needs.parse-tag.outputs.language }}:changelogs
artifact-name: patch-changelogs
update-rust-changelogs:
name: Update Rust Changelogs
needs: [parse-tag, commit-versions]
if: needs.parse-tag.outputs.language == 'all'
uses: ./.github/workflows/upload-changes.yml
with:
name: Update Rust Changelogs
ref: staging/release-${{ needs.parse-tag.outputs.tag }}
run: ./scripts/github-actions/deepen-fetch-to-tag.sh ${{ needs.parse-tag.outputs.tag }} && ./go rust:changelogs
artifact-name: patch-rust-changelogs
update-authors:
name: Update Authors
needs: [parse-tag, commit-versions]
if: needs.parse-tag.outputs.language == 'all'
uses: ./.github/workflows/upload-changes.yml
with:
name: Update Authors
run: ./scripts/github-actions/deepen-fetch-to-tag.sh ${{ needs.parse-tag.outputs.tag }} && ./go authors
artifact-name: patch-authors
update-manager:
name: Update Selenium Manager Binaries
needs: [parse-tag, selenium-manager]
if: needs.parse-tag.outputs.language == 'all'
uses: ./.github/workflows/bazel.yml
with:
name: Update Selenium Manager Binaries
run: ./go update_manager ${{ needs.selenium-manager.outputs.tag }}
artifact-name: patch-manager
use-cache: false
create-pr:
name: Create Pull Request
needs: [parse-tag, update-changelogs, update-rust-changelogs, update-authors, update-manager]
if: >-
always() && !cancelled() &&
needs.update-changelogs.result == 'success' &&
(needs.parse-tag.outputs.language != 'all' ||
(needs.update-rust-changelogs.result == 'success' &&
needs.update-authors.result == 'success' &&
needs.update-manager.result == 'success'))
runs-on: ubuntu-latest
steps:
- name: Checkout trunk
uses: actions/checkout@v6
with:
token: ${{ secrets.SELENIUM_CI_TOKEN }}
- name: Download all patches
uses: actions/download-artifact@v8
with:
pattern: patch-*
path: patches
- name: Prep git
run: |
git config --local user.email "selenium-ci@users.noreply.github.com"
git config --local user.name "Selenium CI Bot"
- name: Apply patches and commit
id: apply
run: |
apply_patch() {
local name="$1"
local msg="$2"
local patch="patches/patch-$name/changes.patch"
if [ -f "$patch" ] && [ -s "$patch" ]; then
git apply --index "$patch"
git commit -m "$msg"
echo "${name}=true" >> "$GITHUB_OUTPUT"
else
echo "${name}=false" >> "$GITHUB_OUTPUT"
fi
}
apply_patch versions "bump versions"
apply_patch changelogs "changelogs updated"
apply_patch rust-changelogs "rust changelogs updated"
apply_patch manager "update selenium manager versions"
apply_patch authors "update authors file"
rm -rf patches
- name: Create Pull Request
id: create-pr
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.SELENIUM_CI_TOKEN }}
author: Selenium CI Bot <selenium-ci@users.noreply.github.com>
delete-branch: true
branch: release-preparation-${{ needs.parse-tag.outputs.tag }}
base: trunk
title: "Release ${{ needs.parse-tag.outputs.tag }}"
body: |
### Release Info
| | |
|-----------|--------|
| **Tag** | ${{ needs.parse-tag.outputs.tag }} |
| **Version** | ${{ needs.parse-tag.outputs.version }} |
| **Language** | ${{ needs.parse-tag.outputs.language }} |
### Updates Applied
| Component | Status |
|-----------|--------|
| Versions | ${{ steps.apply.outputs.versions == 'true' && '✅ Updated' || '⏭️ Skipped (no changes)' }} |
| Changelogs | ${{ steps.apply.outputs.changelogs == 'true' && '✅ Updated' || '⏭️ Skipped (no changes)' }} |
| Rust Changelogs | ${{ needs.parse-tag.outputs.language != 'all' && 'N/A' || (steps.apply.outputs.rust-changelogs == 'true' && '✅ Updated' || '⏭️ Skipped (no changes)') }} |
| Selenium Manager | ${{ needs.parse-tag.outputs.language != 'all' && 'N/A' || (steps.apply.outputs.manager == 'true' && '✅ Updated' || '⏭️ Skipped (no changes)') }} |
| Authors | ${{ needs.parse-tag.outputs.language != 'all' && 'N/A' || (steps.apply.outputs.authors == 'true' && '✅ Updated' || '⏭️ Skipped (no changes)') }} |
---
Auto-generated by [release-preparation workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
labels: C-build
- name: Merge once required checks pass
env:
GH_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }}
GH_REPO: ${{ github.repository }}
run: gh pr merge "${{ steps.create-pr.outputs.pull-request-number }}" --auto --squash
cleanup-staging-branch:
name: Cleanup Staging Branch
needs: [parse-tag, create-pr]
if: always()
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v6
with:
token: ${{ secrets.SELENIUM_CI_TOKEN }}
- name: Delete staging branch
run: |
git push origin --delete staging/release-${{ needs.parse-tag.outputs.tag }} || true
unlock-trunk-on-failure:
name: Unlock Trunk on Failure
needs: [parse-tag, restrict-trunk, generate-rust-version, push-rust-version, selenium-manager, update-versions, commit-versions, update-changelogs, update-rust-changelogs, update-authors, update-manager, create-pr]
if: always() && needs.restrict-trunk.result == 'success' && needs.create-pr.result != 'success'
uses: ./.github/workflows/restrict-trunk.yml
with:
unlock: true
secrets:
SELENIUM_CI_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
on-prerelease-failure:
name: On Pre-release Failure
runs-on: ubuntu-latest
needs: [parse-tag, verify-cdp, restrict-trunk, generate-rust-version, push-rust-version, selenium-manager, update-versions, commit-versions, update-changelogs, update-rust-changelogs, update-authors, update-manager, create-pr]
if: failure() || cancelled()
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_ICON_EMOJI: ":rotating_light:"
SLACK_COLOR: failure
SLACK_CHANNEL: selenium-tlc
SLACK_USERNAME: GitHub Workflows
SLACK_MESSAGE: |
Release preparation failed: ${{ needs.parse-tag.outputs.tag }}
• CDP Current: ${{ needs.verify-cdp.result }}
• Selenium Manager: ${{ needs.selenium-manager.result }}
• Versions: ${{ needs.commit-versions.result }}
• Changelogs: ${{ needs.update-changelogs.result }}
• Rust Changelogs: ${{ needs.update-rust-changelogs.result }}
• Authors: ${{ needs.update-authors.result }}
• Selenium Manager Update: ${{ needs.update-manager.result }}
• Create PR: ${{ needs.create-pr.result }}
<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|view run>
MSG_MINIMAL: true
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}