Skip to content

Merge pull request #21 from neuromatch/NMA_impact_scholars #25

Merge pull request #21 from neuromatch/NMA_impact_scholars

Merge pull request #21 from neuromatch/NMA_impact_scholars #25

Workflow file for this run

name: publish-book
on:
push:
branches:
- main
workflow_dispatch:
env:
NB_KERNEL: python
NMA_REPO: impact-scholars
NMA_MAIN_BRANCH: main
# This job installs dependencies, build the book, and pushes it to `gh-pages`
jobs:
build-and-deploy-book:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Get commit message
run: |
readonly local msg=$(git log -1 --pretty=format:"%s")
echo "COMMIT_MESSAGE=$msg" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install XKCD fonts
if: "!contains(env.COMMIT_MESSAGE, 'skip ci')"
run: |
sudo apt-get update -yq
wget http://archive.ubuntu.com/ubuntu/pool/universe/f/fonts-humor-sans/fonts-humor-sans_1.0-4_all.deb
sudo dpkg -i --force-all fonts-humor-sans_1.0-4_all.deb <<< 'yes'
sudo apt install -fy
rm -f $HOME/.matplotlib/fontList.cache
- name: Build the book
run: |
pip install jupyter-book ghp-import
jupyter-book build .
- name: Commit book
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
ghp-import -n -c "impact-scholars.neuromatch.io" -m "Update course book" _build/html
git checkout -f gh-pages
- name: Publish to gh-pages
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
force: true