Skip to content

CI: GitHub Action workflow concurrency updates #4495

CI: GitHub Action workflow concurrency updates

CI: GitHub Action workflow concurrency updates #4495

Workflow file for this run

# 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/<branch>, refs/tags/<tag>, etc.) or SHA'
required: true
type: string
default: 'refs/heads/main'
concurrency:
group: ${{ github.workflow }}-${{ inputs.ref || github.ref }}
cancel-in-progress: true
env:
ref: ${{ inputs.ref || github.ref }}
jobs:
path-filter:
permissions:
pull-requests: read # dorny/paths-filter
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
ref: ${{ env.ref }}
- id: filter
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
with:
filters: |
changes:
- 'docs/**'
- '**/*.md'
- 'mkdocs.yml'
lint:
needs:
- path-filter
if: ${{ needs.path-filter.outputs.changes == 'true' }}
permissions:
contents: read # actions/checkout
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
ref: ${{ env.ref }}
# TODO(cemmer): MD060, markdownlint doesn't like the way WebStorm aligns tables
- run: docker run --rm --volume "${PWD}:/workdir" ghcr.io/igorshubovych/markdownlint-cli:latest --disable MD013 MD033 MD041 MD046 MD060 -- "**/*.md"
build:
needs:
- path-filter
if: ${{ github.event_name == 'pull_request' && needs.path-filter.outputs.changes == 'true' }}
permissions:
contents: read # actions/checkout, mkdocs-git-committers
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
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/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.x
- run: |
set -x
pip install --requirement docs/requirements.txt
sudo apt-get update
sudo apt-get install libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
- run: npm run docs:build
env:
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ github.token }}
# !!! This check should be required by GitHub !!!
pages-status-check:
needs:
- path-filter
- lint
- build
if: always()
permissions: {}
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1
with:
jobs: ${{ toJSON(needs) }}
allowed-skips: lint, build
deploy:
if: ${{ github.event_name != 'pull_request' }}
permissions:
contents: write # mkdocs gh-deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# zizmor: ignore[artipacked] The persisted credentials are required for the
# subsequent `mkdocs gh-deploy`, which pushes the built site to the gh-pages branch.
# TODO(cemmer): replace with actions/upload-pages-artifact
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/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.x
- run: |
set -x
pip install --requirement docs/requirements.txt
sudo apt-get update
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 }}