| 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: |
| parse: |
| name: Parse Tag |
| 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" |
| |
| # 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" |
| |
| generate-docs: |
| name: Generate Documentation |
| needs: parse |
| uses: ./.github/workflows/bazel.yml |
| with: |
| name: Generate Docs |
| ref: ${{ inputs.tag }} |
| run: ./go ${{ needs.parse.outputs.language }}:docs skip_update |
| artifact-name: documentation |
| artifact-path: docs/api/**/* |
| |
| commit-docs: |
| name: Commit Documentation |
| needs: [parse, generate-docs] |
| 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 |
| - name: Setup git |
| run: | |
| git config --local user.email "selenium-ci@users.noreply.github.com" |
| git config --local user.name "Selenium CI Bot" |
| - name: Commit documentation |
| run: | |
| git add docs/api/ |
| if git diff --staged --quiet; then |
| echo "No documentation changes to commit" |
| else |
| git commit -m "Update ${{ needs.parse.outputs.language }} documentation for Selenium ${{ needs.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 |