| name: Update Documentation |
| |
| on: |
| workflow_dispatch: |
| inputs: |
| version: |
| description: Release version (e.g., 4.21.0) |
| required: true |
| type: string |
| language: |
| description: language documentation |
| required: true |
| type: choice |
| default: "all" |
| options: |
| - java |
| - rb |
| - py |
| - dotnet |
| - node |
| - all |
| force: |
| description: Force generation even if version is nightly, type "force" to enable |
| required: false |
| type: string |
| default: "" |
| |
| workflow_call: |
| inputs: |
| version: |
| required: true |
| type: string |
| sha: |
| required: true |
| type: string |
| language: |
| required: false |
| type: string |
| default: "all" |
| secrets: |
| SELENIUM_CI_TOKEN: |
| required: true |
| |
| permissions: |
| contents: write |
| pull-requests: write |
| |
| env: |
| GITHUB_TOKEN: ${{ github.token }} |
| |
| jobs: |
| build-docs: |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@v4 |
| with: |
| ref: ${{ github.event_name == 'workflow_dispatch' && github.ref || inputs.sha }} |
| - name: Fetch gh-pages branch |
| run: git fetch origin 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 Java |
| if: ${{ inputs.language == 'java' || inputs.language == 'all' }} |
| uses: actions/setup-java@v4 |
| with: |
| java-version: 17 |
| distribution: 'temurin' |
| - name: Set up Python 3.10 |
| if: ${{ inputs.language == 'py' || inputs.language == 'all' }} |
| uses: actions/setup-python@v6 |
| with: |
| python-version: '3.10' |
| - name: Install dependencies |
| if: ${{ inputs.language == 'py' || inputs.language == 'all' }} |
| run: | |
| python -m pip install --upgrade pip |
| pip install tox |
| - name: Install npm dependencies |
| if: ${{ inputs.language == 'node' || inputs.language == 'all' }} |
| run: | |
| npm install |
| npm install --prefix javascript/selenium-webdriver |
| - name: Generate Documentation for selected langauges |
| run: ./go ${{ inputs.language }}:docs ${{ inputs.force }} |
| - name: Documentation Pull Request |
| id: cpr |
| uses: peter-evans/create-pull-request@v6 |
| with: |
| token: ${{ secrets.SELENIUM_CI_TOKEN }} |
| author: Selenium CI Bot <selenium-ci@users.noreply.github.com> |
| delete-branch: true |
| branch: api-docs-${{ inputs.version }} |
| base: gh-pages |
| add-paths: docs/api/** |
| title: Update documentation for Selenium ${{ inputs.version }}-${{ inputs.language }} |
| body: | |
| This PR updates the API documentation for version **${{ inputs.version }}-${{ inputs.language }}**. |
| |
| - Auto-generated by [workflow run #${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) |
| labels: B-docs |
| draft: false |
| - name: Enable Pull Request Auto-merge |
| if: steps.cpr.outputs.pull-request-operation == 'created' |
| uses: peter-evans/enable-pull-request-automerge@v3 |
| with: |
| token: ${{ secrets.SELENIUM_CI_TOKEN }} |
| pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} |
| merge-method: squash |