diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9eb552c..ca68c71 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -4,7 +4,9 @@ on: push: branches: - master - - main + pull_request: + branches: + - master permissions: contents: read @@ -17,15 +19,6 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - name: "📥 Checkout" - - - uses: actions/setup-python@v5 - name: "✨ Set up Python" - id: "setup-python" - with: - python-version: 3.x - - uses: actions/cache@v4 name: "🗃 Cache" with: @@ -35,12 +28,26 @@ jobs: .cache .venv - - name: "📥 Install Material for MkDocs" + - uses: actions/checkout@v4 + name: "📥 Checkout" + with: + fetch-depth: 0 + + - name: "✨ Install Poetry" run: | - python -m venv .venv - .venv/bin/pip install --upgrade 'mkdocs-material~=9.0' 'mkdocs-autorefs~=0.4' 'mkdocstrings[python]~=0.20' 'mkdocs-git-revision-date-localized-plugin~=1.1' pillow cairosvg + pipx install poetry + pipx inject poetry poetry-dynamic-versioning + + - name: 🐍 Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + cache: poetry + + - name: "📥 Install dependencies" + run: poetry install --no-root --with=dev - - run: ".venv/bin/mkdocs build --site-dir _site" + - run: "make docs" name: "📦 Build" - name: "📤 Upload" @@ -50,6 +57,7 @@ jobs: name: "Deploy" runs-on: ubuntu-latest needs: "build" + if: github.event_name == 'push' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/.gitignore b/.gitignore index 6ee6fed..bee1b76 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .benchmarks .cache +_site # Created by https://www.toptal.com/developers/gitignore/api/linux,macos,python,windows,sublimetext,intellij+all,visualstudiocode # Edit at https://www.toptal.com/developers/gitignore?templates=linux,macos,python,windows,sublimetext,intellij+all,visualstudiocode diff --git a/Makefile b/Makefile index c409648..27b8642 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ BIN := venv/bin .PHONY: all -all: install lint test build +all: install lint test build docs .PHONY: clean clean: @@ -45,3 +45,7 @@ benchmark: .PHONY: build build: poetry build + +.PHONY: docs +docs: + poetry run mkdocs build --site-dir _site diff --git a/mkdocs.yml b/mkdocs.yml index 3b7c801..164af52 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -63,8 +63,8 @@ markdown_extensions: - attr_list - pymdownx.details - pymdownx.emoji: - emoji_index: !!python/name:materialx.emoji.twemoji - emoji_generator: !!python/name:materialx.emoji.to_svg + emoji_index: !!python/name:material.extensions.emoji.twemoji + emoji_generator: !!python/name:material.extensions.emoji.to_svg - pymdownx.highlight: anchor_linenums: true - pymdownx.inlinehilite