Skip to content

Update Documentation #52

Update Documentation

Update Documentation #52

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
- rb
- py
- dotnet
- node
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"
# Check for language suffix and map to internal names
case "$TAG" in
*-javascript) LANG="node" ;;
*-python) LANG="py" ;;
*-ruby) LANG="rb" ;;
*-java) LANG="java" ;;
*-dotnet) LANG="dotnet" ;;
*) LANG="all" ;;
esac
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 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