Modernize packaging (#86) #127
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: website | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: setup micromamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: docs/environment.yml | |
environment-name: docs | |
- name: Install current theme in dev mode | |
run: | | |
pip install -e . | |
- name: Describe environment | |
run: | | |
pwd | |
ls | |
conda list | |
- name: Build Sphinx documentation | |
run: | | |
cd docs | |
make html | |
- name: Checkout gh-pages | |
if: success() | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
path: 'deploy' | |
clean: false | |
- name: Prepare development deployment | |
if: success() && github.event_name == 'push' | |
env: | |
PR: ${{ github.event.number }} | |
run: | | |
rm -rf deploy/dev | |
mv docs/_build/html deploy/dev | |
- name: Prepare release deployment | |
if: success() && github.event_name == 'release' | |
env: | |
PR: ${{ github.event.number }} | |
run: | | |
rm -rf deploy/${GITHUB_REF} | |
mv docs/_build/html deploy/${GITHUB_REF} | |
rm deploy/latest | |
ln -s deploy/${GITHUB_REF} deploy/latest | |
- name: Deploy to GitHub Pages | |
if: success() | |
uses: crazy-max/ghaction-github-pages@v4 | |
with: | |
target_branch: gh-pages | |
build_dir: deploy | |
jekyll: false | |
commit_message: "Deploy to GH Pages" | |
keep_history: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |