Merge pull request #178 from Python-GIS-book/develop #79
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
# Copied from https://github.com/urbangrammarai/data_processing/blob/master/.github/workflows/build_book.yml | |
name: Build Jupyter book | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
Linting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
- uses: pre-commit/[email protected] | |
build-html-and-deploy: | |
needs: Linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-version: latest | |
miniforge-variant: Mambaforge | |
use-mamba: true | |
auto-activate-base: false | |
python-version: '3.10' | |
environment-file: ci/build-website.yaml | |
activate-environment: build-web-book | |
- name: Build HTML | |
shell: bash -l {0} | |
continue-on-error: false | |
run: | | |
make book | |
mkdir -p /tmp/book-build | |
mv docs/* /tmp/book-build/ | |
- name: Checkout gh-pages branch | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
ref: gh-pages | |
# Copy the generated docs to gh-pages branch | |
- name: Copy files to gh-pages branch | |
run: | | |
rm -rf * # Clean up current content | |
cp -r /tmp/book-build/* . # Copy the built files from the previous step | |
touch .nojekyll | |
- name: Commit files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "GA build of book HTML" --allow-empty | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
force: true | |
branch: gh-pages |