Skip to content

Don't cache git credentials in workflows #43

Don't cache git credentials in workflows

Don't cache git credentials in workflows #43

Workflow file for this run

name: "Sphinx: Render docs"
on:
pull_request:
branches:
- "**"
paths:
# Run for changes to *this* workflow file, but not for other workflows
- ".github/workflows/docs.yml"
# Trigger off docs and Python source code changes
- "docs/**"
- "src/**.py"
push:
branches:
- main
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
# Not actually a matrix build, but defined as one for consistency
max-parallel: 1
matrix:
python-version: [3.12]
os: [ubuntu-latest]
permissions:
# Allow updating the gh-pages branch
contents: write
# Check https://github.com/actions/action-versions/tree/main/config/actions
# for latest versions if the standard actions start emitting warnings
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
# sphinx-action uses docker under the hood and doesn't play nice with the
# dependency caching, so it may be better to switch to using `tox -e docs`
# and living without the nice integrated GitHub Actions error reporting.
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python-version }}
# - name: Get pip cache dir
# id: pip-cache
# run: |
# echo "dir=$(python -m pip cache dir)" >> $GITHUB_OUTPUT
# - name: Cache docs build dependencies
# uses: actions/cache@v4
# with:
# path: ${{ steps.pip-cache.outputs.dir }}
# key:
# pip-docs-${{ matrix.os }}-${{ matrix.python-version }}-v1-${{ hashFiles('docs/requirements.txt') }}
# restore-keys: |
# pip-docs-${{ matrix.os }}-${{ matrix.python-version }}-v1-
- name: Build HTML
uses: ammaraskar/[email protected]
with:
docs-folder: "docs/"
# Skip link check until after the venvstacks repo is public
# pre-build-command: "sphinx-build -b linkcheck . _build"
build-command: "sphinx-build -b dirhtml . _build"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: html-docs
path: docs/_build/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/