diff --git a/.devcontainer.json b/.devcontainer.json index 2c31ad6..6c6f8de 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -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"}} } diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..54caafc --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,39 @@ +# see https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml +name: build & deploy 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 + - run: pip install -r requirements.txt + - 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 + touch references.bib # TODO: remove + 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 diff --git a/README.md b/README.md index 0728c5c..64d63e5 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/_config.yml b/_config.yml index dfdaec6..50877a8 100644 --- a/_config.yml +++ b/_config.yml @@ -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