ci(docs)📝: Update GitHub Actions workflow for documentation #658
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build documentation | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
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@v4 | |
- name: Setup Pixi Environment | |
uses: prefix-dev/[email protected] | |
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: Deploy website | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
# https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-set-personal-access-token-personal_token | |
personal_token: ${{ secrets.GHPAGES_DEPLOY_KEY }} | |
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.ref_name == 'main' | |
uses: rossjrw/[email protected] | |
with: | |
source-dir: ./site | |
preview-branch: gh-pages |