Skip to content

Commit

Permalink
add CI build & deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Aug 17, 2023
1 parent a87b6be commit dd94d01
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"streetsidesoftware.code-spell-checker"
]}},
"postCreateCommand": "pip install --user -r requirements.txt",
"postStartCommand": "jupyter-book build -W . && python -m http.server -d _build/html",
"postStartCommand": "jupyter-book build -W -n . && python -m http.server -d _build/html",
"portsAttributes": {"8000": {"label": "Webserver", "onAutoForward": "notify"}}
}
37 changes: 37 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# see https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml
name: Build & Publish site
on:
push:
workflow_dispatch:
permissions:
# allow GITHUB_TOKEN to deploy to GitHub Pages
contents: read
pages: write
id-token: write
concurrency: {group: "pages", cancel-in-progress: true}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with: {python-version: '3.x'}
- id: pages
uses: actions/configure-pages@v3
- name: jupyter-book build
run: |
sed -ri 's#^(\s*baseurl:).*#\1 ${{ steps.pages.outputs.base_url }}#' _config.yml
# https://jupyterbook.org/en/stable/reference/cli.html
jupyter-book build --warningiserror --nitpick .
- uses: actions/upload-pages-artifact@v2
with: {path: _build/html}
deploy:
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- id: deployment
uses: actions/deploy-pages@v2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Open this repository ({{ repo_url }}) in a [Dev Container](https://containers.de

```sh
pip install -r requirements.txt
jupyter-book build --all -W .
jupyter-book build --all .
python -m http.server -d _build/html
```

Expand Down
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ sphinx:
extra_extensions:
- sphinxemoji.sphinxemoji
html:
baseurl: http://localhost:8000/
favicon: assets/favicon.ico
use_edit_page_button: true
use_issues_button: true
Expand Down

0 comments on commit dd94d01

Please sign in to comment.