diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..4a944e8 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,82 @@ +name: docs + +on: + push: + branches: + - main + paths: + - ".github/workflows/docs.yml" + - "docs/**" + - "dmf/**" + - "mkdocs.yml" + - "pyproject.toml" + - "poetry.lock" + - "Makefile" + pull_request: + paths: + - ".github/workflows/docs.yml" + - "docs/**" + - "dmf/**" + - "mkdocs.yml" + - "pyproject.toml" + - "poetry.lock" + - "Makefile" + workflow_dispatch: + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + name: Build MkDocs site + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.12" + + - name: Install Poetry + run: pipx install poetry + + - name: Configure Poetry + run: poetry config virtualenvs.in-project true + + - name: Install documentation dependencies + run: poetry install --with docs --no-interaction + + - name: Build documentation + run: poetry run mkdocs build --site-dir site + + - name: Configure GitHub Pages + uses: actions/configure-pages@v5 + + - name: Upload GitHub Pages artifact + uses: actions/upload-pages-artifact@v4 + with: + path: site + + deploy: + name: Deploy to GitHub Pages + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4