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: required: false type: string default: "" secrets: SELENIUM_CI_TOKEN: required: true permissions: contents: write env: GITHUB_TOKEN: ${{ github.token }} jobs: build-docs: runs-on: ubuntu-latest 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 suffix from tag (e.g., selenium-4.28.1-ruby -> ruby) if [[ "$TAG" =~ -([a-z]+)$ ]]; then LANG="${BASH_REMATCH[1]}" else LANG="all" fi # User-provided language input overrides tag suffix if [ -n "$INPUT_LANG" ] && [ "$INPUT_LANG" != "all" ]; then LANG="$INPUT_LANG" fi echo "language=$LANG" >> "$GITHUB_OUTPUT" - name: Checkout repository uses: actions/checkout@v4 with: ref: ${{ inputs.tag }} - name: Fetch gh-pages branch run: git fetch origin gh-pages - name: Setup gh-pages worktree run: git worktree add ../gh-pages gh-pages - name: Setup 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: Generate Documentation for selected languages run: ./go ${{ steps.parse.outputs.language }}:docs - name: Commit documentation to gh-pages run: | cp -r build/docs/api/* ../gh-pages/docs/api/ cd ../gh-pages git add docs/api/ if git diff --staged --quiet; then echo "No documentation changes to commit" else git commit -m "Update ${{ steps.parse.outputs.language }} documentation for Selenium ${{ steps.parse.outputs.version }}" for _ in 1 2; do git pull --rebase origin gh-pages && git push origin gh-pages && exit 0 sleep 2 done exit 1 fi