Update Documentation #66
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Documentation | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Release tag (e.g., selenium-4.29.0 or selenium-4.28.1-ruby)' | |
| required: true | |
| type: string | |
| language: | |
| description: 'Language (overrides tag suffix if provided)' | |
| required: false | |
| type: choice | |
| default: "all" | |
| options: | |
| - all | |
| - java | |
| - ruby | |
| - python | |
| - dotnet | |
| - javascript | |
| workflow_call: | |
| inputs: | |
| tag: | |
| required: true | |
| type: string | |
| language: | |
| type: string | |
| default: "" | |
| skip: | |
| description: We're not releasing this one right now | |
| type: boolean | |
| default: false | |
| secrets: | |
| SELENIUM_CI_TOKEN: | |
| required: true | |
| permissions: | |
| contents: write | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| jobs: | |
| parse: | |
| name: Parse Tag | |
| if: ${{ !inputs.skip }} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.parse.outputs.version }} | |
| language: ${{ steps.parse.outputs.language }} | |
| steps: | |
| - name: Parse tag | |
| id: parse | |
| env: | |
| TAG: ${{ inputs.tag }} | |
| INPUT_LANG: ${{ inputs.language }} | |
| run: | | |
| echo "version=$(echo "$TAG" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT" | |
| # Extract language from tag suffix or use input | |
| if [ -n "$INPUT_LANG" ] && [ "$INPUT_LANG" != "all" ]; then | |
| LANG="$INPUT_LANG" | |
| elif [[ "$TAG" =~ -(javascript|python|ruby|java|dotnet)$ ]]; then | |
| LANG="${BASH_REMATCH[1]}" | |
| else | |
| LANG="all" | |
| fi | |
| echo "language=$LANG" >> "$GITHUB_OUTPUT" | |
| generate-docs: | |
| name: Generate Documentation | |
| needs: parse | |
| if: ${{ !inputs.skip }} | |
| uses: ./.github/workflows/bazel.yml | |
| with: | |
| name: Generate Docs | |
| ref: ${{ inputs.tag }} | |
| run: | | |
| RUBY_VER=$(cat rb/.ruby-version) | |
| curl -fsSL -o /tmp/ruby.tar.gz \ | |
| "https://github.com/jdx/ruby/releases/download/${RUBY_VER}/ruby-${RUBY_VER}.x86_64_linux.tar.gz" | |
| NEW_SHA=$(sha256sum /tmp/ruby.tar.gz | awk '{print $1}') | |
| RR_VER=$(grep -oE 'rules_ruby[^0-9]+[0-9]+\.[0-9]+\.[0-9]+' MODULE.bazel | head -1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') | |
| git clone --depth 1 --branch "v${RR_VER}" \ | |
| https://github.com/bazel-contrib/rules_ruby /tmp/rules_ruby | |
| sed -i -E "s|(\"ruby-${RUBY_VER}\.x86_64_linux\.tar\.gz\"[[:space:]]*:[[:space:]]*\")[0-9a-f]{64}|\1${NEW_SHA}|" \ | |
| /tmp/rules_ruby/ruby/private/portable_ruby_checksums.bzl | |
| echo "common --override_module=rules_ruby=/tmp/rules_ruby" >> .bazelrc | |
| ./go ${{ needs.parse.outputs.language }}:docs | |
| artifact-name: documentation-${{ needs.parse.outputs.language }} | |
| artifact-path: build/docs/api/**/* | |
| commit-docs: | |
| name: Commit Documentation | |
| needs: [parse, generate-docs] | |
| if: ${{ !inputs.skip }} | |
| concurrency: | |
| group: gh-pages-write | |
| cancel-in-progress: false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout gh-pages | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: gh-pages | |
| token: ${{ secrets.SELENIUM_CI_TOKEN || github.token }} | |
| - name: Download documentation | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: documentation-${{ needs.parse.outputs.language }} | |
| path: docs/api | |
| - name: Commit documentation | |
| run: | | |
| git config --local user.email "selenium-ci@users.noreply.github.com" | |
| git config --local user.name "Selenium CI Bot" | |
| git add docs/api/ | |
| git diff --staged --quiet || { | |
| git commit -m "Update ${{ needs.parse.outputs.language }} documentation for Selenium ${{ needs.parse.outputs.version }}" | |
| git push origin gh-pages | |
| } |