Deploying a jupyter{book} website

Lohithmunakala
2 min readAug 23, 2021

--

In the previous blog, we looked at how we can create a jupyter{book} website. In this particular blog, let us look at the ways we can deploy them using GitHub.

There are 3 main ways in which you can deploy your code to GitHub Pages .

  1. Directly uploading the code to GitHub
  2. Using ghp-import
  3. Using GitHub Actions

I will be covering the 2nd and 3rd options as these are the easiest to do. And I do not prefer going for the 1st option.

Using ghp-import

This is the easiest way you can use GitHub pages to host your website. To do this, you need to make sure you have ghp-import on your system. To install it, run the following command. Make sure you have uploaded your code onto GitHub.

ghp-import installation command

To host the website on your repo, run the following command.

webpage build command using ghp-import

ghp-import creates a copy of all _build/html files that are built and copies them onto a new branch named gh-pages.

The website will be hosted here: <username>.github.io/<repo name>

Using GitHub Actions

You can enable GA on your repository and create a YAML file to take care of automatic deployments. The following is the standard code you can add to your GA file.

GA for automatic deployment of the code

Here is the code in case you wanted to take a peak at how the code is written along with binder deployments for IOOS.

Once you add this GitHub Action in your .github folder, it will automatically deploy your website. The link to your website will be in this format <username>.github.io/<repo name>

--

--