# Requires GitHub Pages publishing branch to be `gh-pages` name: GitHub Pages on: pull_request: release: types: - published workflow_dispatch: inputs: ref: description: 'Git ref (refs/heads/, refs/tags/, etc.) or SHA' required: true type: string default: 'refs/heads/main' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: ref: ${{ inputs.ref || github.ref }} cache_version: v2 jobs: path-filter: permissions: pull-requests: read runs-on: ubuntu-latest outputs: changes: ${{ steps.filter.outputs.changes }} steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 with: ref: ${{ env.ref }} - id: filter uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 with: filters: | changes: - 'docs/**' - '**/*.md' - 'mkdocs.yml' lint: needs: - path-filter if: ${{ needs.path-filter.outputs.changes == 'true' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 with: ref: ${{ env.ref }} - run: docker run --rm --volume "${PWD}:/workdir" ghcr.io/igorshubovych/markdownlint-cli:latest --disable MD013 MD033 MD041 MD046 -- "**/*.md" build: needs: - path-filter if: ${{ github.event_name == 'pull_request' && needs.path-filter.outputs.changes == 'true' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 with: ref: ${{ env.ref }} # the `git-revision-date-localized` plugin needs full history to find page creation date fetch-depth: 0 sparse-checkout: | docs # Symlinked paths .github/CONTRIBUTING.md static LICENSE README.md - uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 with: key: mkdocs-${{ env.cache_version }}-${{ env.ref }} restore-keys: | mkdocs-v2-refs/heads/main path: .cache - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: 3.x - run: | pip install --requirement docs/requirements.txt sudo apt-get install libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev - run: mkdocs build --strict --verbose env: MKDOCS_GIT_COMMITTERS_APIKEY: ${{ github.token }} - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 with: key: mkdocs-${{ env.cache_version }}-${{ env.ref }} path: .cache # !!! This check should be required by GitHub !!! pages-status-check: if: always() needs: - path-filter - lint - build runs-on: ubuntu-latest steps: - uses: re-actors/alls-green@release/v1 with: jobs: ${{ toJSON(needs) }} allowed-skips: lint, build deploy: if: ${{ github.event_name != 'pull_request' }} permissions: contents: write runs-on: ubuntu-latest steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 with: ref: ${{ env.ref }} # the `git-revision-date-localized` plugin needs full history to find page creation date fetch-depth: 0 sparse-checkout: | docs # Symlinked paths .github/CONTRIBUTING.md static LICENSE README.md - uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 with: key: mkdocs-${{ env.cache_version }}-${{ env.ref }} path: .cache - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: 3.x - run: | pip install --requirement docs/requirements.txt sudo apt-get install libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev - run: mkdocs gh-deploy --strict --verbose --force env: MKDOCS_GIT_COMMITTERS_APIKEY: ${{ github.token }} - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 with: key: mkdocs-${{ env.cache_version }}-${{ env.ref }} path: .cache