Fix docs workflow #13
This file contains 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
name: documentation | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
# Build job | |
build: | |
name: Build documentation | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
sparse-checkout: | | |
docs | |
mkdocs.yml | |
- name: Configure Git Credentials | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
- name: Set up Python runtime | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Set the date environmental variable | |
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | |
- name: Set up build cache | |
uses: actions/cache@v3 | |
with: | |
key: mkdocs-material-${{ env.cache_id }} | |
path: .cache | |
restore-keys: | | |
mkdocs-material- | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
# Deployment job | |
deploy: | |
name: Deploy documentation | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Install mkdocs | |
run: pip install mkdocs | |
- name: Deploy to GitHub Pages | |
run: mkdocs gh-deploy --force |