ci: update mkdocs workflow

Bit of a merge of the docs at https://github.com/squidfunk/mkdocs-material/blob/master/docs/publishing-your-site.md and the previous workflow.

Not sure how to test this without access to the main repo.
This commit is contained in:
psychedelicious 2024-03-01 11:35:54 +11:00 committed by Kent Keirsey
parent 77f39aa935
commit 26d4d93e64

View File

@ -1,51 +1,38 @@
name: mkdocs-material # This is a mostly a copy-paste from https://github.com/squidfunk/mkdocs-material/blob/master/docs/publishing-your-site.md
name: mkdocs
on: on:
push: push:
branches: branches:
- 'refs/heads/main' - main
workflow_dispatch:
permissions: permissions:
contents: write contents: write
jobs: jobs:
mkdocs-material: deploy:
if: github.event.pull_request.draft == false if: github.event.pull_request.draft == false
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
REPO_URL: '${{ github.server_url }}/${{ github.repository }}' REPO_URL: '${{ github.server_url }}/${{ github.repository }}'
REPO_NAME: '${{ github.repository }}' REPO_NAME: '${{ github.repository }}'
SITE_URL: 'https://${{ github.repository_owner }}.github.io/InvokeAI' SITE_URL: 'https://${{ github.repository_owner }}.github.io/InvokeAI'
steps:
- name: checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: setup python steps:
uses: actions/setup-python@v4 - uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: with:
python-version: '3.10' python-version: '3.10'
cache: pip cache: pip
cache-dependency-path: pyproject.toml cache-dependency-path: pyproject.toml
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- name: install requirements - uses: actions/cache@v4
env: with:
PIP_USE_PEP517: 1 key: mkdocs-material-${{ env.cache_id }}
run: | path: .cache
python -m \ restore-keys: |
pip install ".[docs]" mkdocs-material-
- run: python -m pip install ".[docs]"
- name: confirm buildability - run: mkdocs gh-deploy --force
run: |
python -m \
mkdocs build \
--clean \
--verbose
- name: deploy to gh-pages
if: ${{ github.ref == 'refs/heads/main' }}
run: |
python -m \
mkdocs gh-deploy \
--clean \
--force