chore(release): 1.3.1 #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-License-Identifier: Apache-2.0 | |
| # Copyright (C) 2025 Marcin Zieba <marcinpsk@gmail.com> | |
| name: Deploy Documentation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'docs/**' | |
| - 'mkdocs.yml' | |
| - 'pyproject.toml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| - name: Set up Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: uv pip install --system "mkdocs-material>=9,<10" | |
| - name: Save coverage report from gh-pages | |
| run: | | |
| if git ls-remote --exit-code origin refs/heads/gh-pages >/dev/null 2>&1; then | |
| git fetch origin refs/heads/gh-pages:gh-pages | |
| if git show gh-pages:coverage/badge.json >/dev/null 2>&1; then | |
| git checkout gh-pages -- coverage/ | |
| mv coverage /tmp/coverage-backup | |
| echo "Coverage report saved" | |
| else | |
| echo "No coverage report found on gh-pages" | |
| fi | |
| else | |
| echo "gh-pages branch does not exist yet, skipping backup" | |
| fi | |
| - name: Deploy documentation | |
| run: mkdocs gh-deploy --force --strict | |
| - name: Restore coverage report | |
| if: always() | |
| run: | | |
| if [ -d /tmp/coverage-backup ]; then | |
| git checkout gh-pages | |
| git fetch origin gh-pages | |
| git reset --hard origin/gh-pages | |
| cp -r /tmp/coverage-backup coverage | |
| git add coverage/ | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git diff --cached --quiet || git commit -m "Restore coverage report after docs deploy [skip ci]" | |
| git pull --rebase origin gh-pages | |
| git push origin gh-pages | |
| echo "Coverage report restored" | |
| fi |