Deploy Settings

Deploy Settings#

Note: The key point is to set the correct deployment branch in the ./github/workflows/deploy.yml.

In the .github/workflows/deploy.yml file, of the cloned repository, specify the branch, to be used by the workflow:

on:
  # Trigger the workflow on push to the main branch
  push:
    branches:
    - main

Upon the git push command to the specified branch[1], the workflow will be triggered.

Note: The specified branch can be any[2], other than the gh-pages.

In the same deploy.yml file set the following permissions:

permissions:
  pages: write
  deployments: write
  contents: write
  statuses: write
  actions: write
  checks: read

This setup uses the main branch in the workflow, but it can also be any other newly created side-branch. Upon the git push, the workflow will be triggered.

The deployment itself is the jupyter-build book data-science-for-esm command. This command is in charge generating the HTML code from the data provided in the data-science-for-esm folder.

Further explanation of this command, i.e. the jupyter-book build, as well as the other commands is provided in the README.md file. A more detailed explanation is to be found in the following Jupyter Book references:

  1. Build from the command line

  2. Structure the Table of Contents

Although it is perfectly fine to trigger the workflow from the main working branch, there are a couple of reasons why you should stay off the main branch and use a feature branch instead. These are explained in the next section.