name: Release Selenium on: pull_request: types: [closed] workflow_dispatch: inputs: tag: description: 'Release tag (e.g., selenium-4.28.0)' required: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} permissions: contents: read jobs: stage: name: Build and Stage Packages runs-on: ubuntu-latest permissions: contents: write if: > github.event.repository.fork == false && ((startsWith(github.event.pull_request.head.ref, 'release-preparation-') && github.event.pull_request.merged == true) || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '')) outputs: tag: ${{ steps.tag.outputs.tag }} version: ${{ steps.tag.outputs.version }} steps: - name: Checkout repo uses: actions/checkout@v4 with: token: ${{ secrets.SELENIUM_CI_TOKEN }} - name: Extract tag and version id: tag env: EVENT_NAME: ${{ github.event_name }} INPUT_TAG: ${{ inputs.tag }} PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} run: | if [ "$EVENT_NAME" == "workflow_dispatch" ]; then TAG="$INPUT_TAG" else VERSION=$(echo "$PR_HEAD_REF" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') TAG="selenium-${VERSION}" fi echo "tag=$TAG" >> "$GITHUB_OUTPUT" echo "version=$(echo "$TAG" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT" - name: Prep git run: | git config --local user.email "selenium-ci@users.noreply.github.com" git config --local user.name "Selenium CI Bot" - name: Setup curl for Ubuntu run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev - name: Setup Bazel uses: bazel-contrib/setup-bazel@0.18.0 with: cache-save: false bazelisk-cache: true external-cache: | manifest: crates: rust/Cargo.Bazel.lock rules_ruby++ruby+ruby: rb/.ruby-version repository-cache: true bazelrc: common --color=yes - name: Build Java & .NET packages run: ./go all:package --config=release - name: Delete nightly release and tag env: GH_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }} run: | if gh release view nightly >/dev/null 2>&1; then gh release delete nightly --yes fi if git ls-remote --tags origin refs/tags/nightly | grep -q nightly; then git push origin --delete refs/tags/nightly fi - name: Draft GitHub release uses: ncipollo/release-action@v1 with: artifacts: "build/dist/*.*" bodyFile: "scripts/github-actions/release_header.md" draft: true generateReleaseNotes: true name: "Selenium ${{ steps.tag.outputs.version }}" prerelease: false skipIfReleaseExists: true tag: "${{ steps.tag.outputs.tag }}" commit: "${{ github.sha }}" get-approval: name: Get Approval needs: stage if: needs.stage.result == 'success' uses: ./.github/workflows/get-approval.yml with: title: Release approval required message: Approval is needed to publish ${{ needs.stage.outputs.tag }}. secrets: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} publish: name: Publish ${{ matrix.language }} needs: get-approval strategy: fail-fast: false matrix: language: [java, python, ruby, dotnet, javascript] uses: ./.github/workflows/bazel.yml with: name: Publish ${{ matrix.language }} gpg-sign: ${{ matrix.language == 'java' }} run: ./go ${{ matrix.language }}:release secrets: inherit verify: name: Verify Published Packages needs: docs uses: ./.github/workflows/bazel.yml with: name: Verify packages run: ./go all:verify docs: name: Update ${{ matrix.language }} Documentation needs: [stage, publish, github-release] permissions: contents: write strategy: fail-fast: false matrix: language: [java, python, ruby, dotnet, javascript] uses: ./.github/workflows/update-documentation.yml with: tag: ${{ needs.stage.outputs.tag }} language: ${{ matrix.language }} secrets: SELENIUM_CI_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }} github-release: name: GitHub Release needs: [stage, publish] runs-on: ubuntu-latest permissions: contents: write steps: - name: Publish GitHub release uses: ncipollo/release-action@v1 with: tag: "${{ needs.stage.outputs.tag }}" draft: false allowUpdates: true omitBodyDuringUpdate: true omitNameDuringUpdate: true unrestrict-trunk: name: Unrestrict Trunk Branch needs: verify uses: ./.github/workflows/restrict-trunk.yml with: restrict: false secrets: inherit update-version: name: Reset Versions to Nightly needs: [stage, unrestrict-trunk] runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout uses: actions/checkout@v4 with: token: ${{ secrets.SELENIUM_CI_TOKEN }} - name: Setup Bazel uses: bazel-contrib/setup-bazel@0.18.0 with: bazelisk-cache: true bazelrc: common --color=yes - name: Prep git run: | git config --local user.email "selenium-ci@users.noreply.github.com" git config --local user.name "Selenium CI Bot" - name: Reset versions to nightly run: ./go all:version nightly - name: Push version changes run: | git commit -m "[build] Reset versions to nightly after ${{ needs.stage.outputs.tag }} release" git push nightly: name: Publish Nightly Packages needs: [update-version] uses: ./.github/workflows/nightly.yml secrets: inherit mirror: name: Update Release Mirror needs: [nightly] uses: ./.github/workflows/mirror-selenium-releases.yml secrets: inherit on-release-failure: name: On Release Failure runs-on: ubuntu-latest needs: [stage, publish, docs, github-release, update-version, nightly, mirror, verify] if: failure() steps: - uses: actions/checkout@v4 - 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_TITLE: Release failed SLACK_MESSAGE: | • Selenium Published: ${{ needs.publish.result }} • Docs Updated: ${{ needs.docs.result }} • GitHub Release Published: ${{ needs.github-release.result }} • Nightly Version Updated: ${{ needs.update-version.result }} • Nightly Packages: ${{ needs.nightly.result }} • Mirror Updated: ${{ needs.mirror.result }} • Packages Verified: ${{ needs.verify.result }} MSG_MINIMAL: actions url SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}