-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfbaebf
commit 4d67cc3
Showing
1 changed file
with
28 additions
and
30 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,40 @@ | ||
name: deploy-book | ||
name: Publish JupyterBook to GitHub Pages | ||
|
||
# Only run this when the main branch changes | ||
on: | ||
push: | ||
on: | ||
push: # trigger build only when push to master | ||
branches: | ||
- 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: | ||
# - some-subfolder/** | ||
- master | ||
|
||
# This job installs dependencies, builds the book, and pushes it to `gh-pages` | ||
jobs: | ||
deploy-book: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
# Install dependencies | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v3 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.11 | ||
python-version: 3.7 | ||
- name: Install Python dependencies | ||
run: | | ||
sudo apt-get install python3-pip | ||
pip install git+git://github.com/executablebookproject/cli.git#egg=master | ||
pip install ghp-import | ||
PATH="${PATH}:${HOME}/.local/bin" | ||
- name: Install dependencies | ||
- name: Build book TOC file | ||
run: | | ||
pip install -r requirements.txt | ||
jupyter-book toc ./content | ||
# Build the book | ||
- name: Build the book | ||
- name: Build book HTML | ||
run: | | ||
jupyter-book build . | ||
jupyter-book build ./content | ||
# Push the book's HTML to github-pages | ||
- name: GitHub Pages action | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./_build/html | ||
- name: Push _build/html to gh-pages | ||
run: | | ||
sudo chown -R $(whoami):$(whoami) . | ||
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" | ||
git config --global user.name "$GITHUB_ACTOR" | ||
git remote set-url origin "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY" | ||
ghp-import ./content/_build/html -f -p -n |