Skip to content

Merge pull request #34 from kaitj/maint/urls #14

Merge pull request #34 from kaitj/maint/urls

Merge pull request #34 from kaitj/maint/urls #14

Workflow file for this run

# based on action from https://github.com/poldrack/psych-open-science-guide
name: Build jupyter book
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U jupyter-book
if [ -f jupyter-book/requirements.txt ]; then pip install -r jupyter-book/requirements.txt; fi
- name: Build book
run: jb build ./jupyter-book/site
- name: Move book into Jekyll-friendly format
run: |
mv ./jupyter-book/site/_build/html ./book
UNDER_DIRECTORIES=$(ls -d ./book/_* | xargs -n 1 basename)
for U_D in $UNDER_DIRECTORIES
do
mv ./book/${U_D} ./book/${U_D:1}
for RELEVANT_FILE in $(grep -rl ${U_D} ./book)
do
echo "Rewriting ${RELEVANT_FILE}"
.github/scripts/update_jb_paths ${RELEVANT_FILE} ${U_D} /book/${U_D:1}
done
done
- uses: oleksiyrudenko/gha-git-credentials@v2-latest
with:
token: '${{ secrets.SITE_PUSH_SECRET }}'
- name: Commit
run: |
git fetch origin || true
git branch -D gh-pages || true
git checkout -b gh-pages
# remove source files
git rm -rf jupyter-book minimal-mistakes .github || true
git add * || true
git commit -m "Publish \"$(git log -1 --pretty=%B)\"" || true
- name: Push book changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.SITE_PUSH_SECRET }}
branch: gh-pages
force: true