Skip to content

Merge pull request #9 from MatDagommer/add-deps #41

Merge pull request #9 from MatDagommer/add-deps

Merge pull request #9 from MatDagommer/add-deps #41

Workflow file for this run

name: Build documentation
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
build-docs:
runs-on: ubuntu-latest
name: Build documentation
# https://github.com/marketplace/actions/setup-miniconda#use-a-default-shell
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Setup Pixi Environment
uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: latest
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
- name: Build docs
run: pixi run build-docs
- name: Verify build output
run: |
# Verify that markdown files are NOT in the site directory
# (They should be processed into HTML by MkDocs)
# The markdown files are generated by the pre-build hook, processed by MkDocs,
# and only the resulting HTML files should be in ./site
if find ./site -name "*.md" | grep -q .; then
echo "ERROR: Markdown files found in site directory!"
find ./site -name "*.md"
exit 1
fi
echo "✓ Build verification passed: No markdown files in site directory"
echo "✓ Site directory contains HTML files ready for deployment"
- name: Deploy website
if: github.ref_name == 'main'
uses: peaceiris/actions-gh-pages@v4
with:
# https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-set-personal-access-token-personal_token
# Note: This action deploys the contents of publish_dir (./site) to gh-pages.
# It does NOT check .gitignore - it simply takes all files in ./site and pushes them.
# Since ./site only contains HTML files (generated from markdown by MkDocs),
# no markdown files will be deployed. The markdown files exist only during
# the build process and are never committed to any branch.
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
publish_branch: gh-pages
allow_empty_commit: false
keep_files: false
force_orphan: true
enable_jekyll: false
- name: Deploy PR Preview
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main'
uses: rossjrw/pr-preview-action@v1.6.3
with:
# Note: This action works similarly - it deploys the contents of source-dir (./site)
# to create a preview. It also does NOT check .gitignore, but since ./site only
# contains HTML files, no markdown files will be included in the preview.
source-dir: ./site
preview-branch: gh-pages