Skip to content

ci: add changed-files for mkdocs #14

ci: add changed-files for mkdocs

ci: add changed-files for mkdocs #14

# This is a mostly a copy-paste from https://github.com/squidfunk/mkdocs-material/blob/master/docs/publishing-your-site.md
name: mkdocs
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
env:
REPO_URL: '${{ github.server_url }}/${{ github.repository }}'
REPO_NAME: '${{ github.repository }}'
SITE_URL: 'https://${{ github.repository_owner }}.github.io/InvokeAI'
steps:
- name: checkout
uses: actions/checkout@v4
- name: check for changed docs
if: ${{ github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' }}
id: changed-files
uses: tj-actions/changed-files@v42
with:
files_yaml: |
docs:
- 'docs/**'
- name: setup python
if: ${{ steps.changed-files.outputs.docs_any_changed == 'true' }}
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
cache-dependency-path: pyproject.toml
- name: set cache id
if: ${{ steps.changed-files.outputs.docs_any_changed == 'true' }}
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- name: use cache
if: ${{ steps.changed-files.outputs.docs_any_changed == 'true' }}
uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- name: install dependencies
if: ${{ steps.changed-files.outputs.docs_any_changed == 'true' }}
run: python -m pip install ".[docs]"
- name: build & deploy
if: ${{ steps.changed-files.outputs.docs_any_changed == 'true' }}
run: mkdocs gh-deploy --force