Fix and polish the release workflow #11
Workflow file for this run
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: deploy-book | |
# Only run this when the master branch changes | |
on: | |
push: | |
branches: | |
- master | |
- main | |
- website | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
branches: | |
- main | |
- master | |
# If your git repository has the Jupyter Book within some-subfolder next to | |
# unrelated files, you can make this run only if a file within that specific | |
# folder has been modified. | |
# | |
# paths: | |
# - book/ | |
# This job installs dependencies, builds the book, and pushes it to `gh-pages` | |
jobs: | |
deploy-book: | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
# https://github.com/JamesIves/github-pages-deploy-action/issues/1110 | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
# Install dependencies | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
pip install -r website/requirements.txt | |
# Install GBasis | |
- name: Install package | |
run: | | |
pip install -e . | |
# Build the documentation | |
- name: Build the documentation | |
run: | | |
sphinx-apidoc -o website/_autosummary gbasis -M -f | |
# make a soft link to the notebooks/tutorial folder | |
- name: Make a soft link to the notebooks | |
run: | | |
cd website | |
ln -s ../notebooks/tutorial ./tutorial | |
cd ../ | |
# Build the book | |
- name: Build the website | |
run: | | |
jupyter-book build ./website/ | |
# Push the book's HTML to github-pages | |
# inspired by https://github.com/orgs/community/discussions/26724 | |
# only push to gh-pages if the master branch has been updated | |
- name: GitHub Pages Action | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
uses: peaceiris/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./website/_build/html | |
publish_branch: gh-pages | |
cname: gbasis.qcdevs.org |