diff --git a/book/_toc.yml b/book/_toc.yml index 79920d1..d9775ac 100644 --- a/book/_toc.yml +++ b/book/_toc.yml @@ -30,6 +30,7 @@ parts: - file: basic-features/hypothesis - file: features/overview sections: + - file: features/github_deploy.md - file: features/remove_from_publish - file: features/custom_toc.md - file: features/custom_download.md diff --git a/book/features/github_deploy.md b/book/features/github_deploy.md new file mode 100644 index 0000000..29d0428 --- /dev/null +++ b/book/features/github_deploy.md @@ -0,0 +1,31 @@ +# Publish online with GitHub Pages + +```{admonition} User types +:class: tip +This page is useful for user type 3, 4 and 5. +``` + +We developed a workflow which builds the Jupyter books in your repository for all branches, and publishes them online via GitHub Pages. The [GitHub template book](../workflows/githubtemplate.md) uses this functionality for example. + +To use this feature, add the workflow [`call-deploy-book.yml`](https://github.com/TeachBooks/deploy-book-workflow/blob/main/.github/workflows/call-deploy-book.yml) to the `/.github/workflows` folder in your repository. Furthermore, set source for GitHub pages to GitHub Actions under `Settings` - `Pages` - `Build and deployment` - `Source` - `GitHub Actions`. Additional tip: set repository website as your GitHub Pages website under `Code`- `About` - - `Website` - `Use your GitHub Pages Website` + +You can adapt the behaviour by setting repository variables in GitHub as explained [here](https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-a-repository). Define the following repository variables: +- `PRIMARY_BRANCH` which is set to `main` whenever it's not defined in the repository variables. + - This sets the branch which is hosted on root. + - It is advised to make it `published` to start using draft-publish-workflow +- `BRANCH_ALIASES` which is set to `draft:main` whenever it's not defined in the repository variables. + - This defines aliases for branches + - It should be a space-separated list of alias-rules, e.g. 'draft:main alias:really-long-branch-name` + - It is advised to link `book` to `publish`. + - If no aliases are wanted, BRANCH_ALIASES may be set to ' ' (space). +- `BRANCHES_TO_DEPLOY` which is set to `*` (all branches) whenever it's not defined in the repository variables. + - This defines the branches to deploy. + - It should be a space-separated list of branch names, e.g. 'main second third'.- + +In `call-deploy-book.yml` itself you can specify the trigger for this workflow. By default, a push to any branch trigger the workflow. You can limit the branches or subdirectories. + +Whenever the workflow is triggered, progress can be seen under the `Actions` tab in GitHub. From this tab, you can also initiate it without any trigger commits. + +When the workflow has finished, visit your build book at `https://.github.io/` (case sensitive). Eg. for the [template book](https://github.com/TeachBooks/template) it is [https://teachbooks.github.io/template](). \ No newline at end of file diff --git a/book/workflows/githubtemplate.md b/book/workflows/githubtemplate.md index caa2731..d1183c6 100644 --- a/book/workflows/githubtemplate.md +++ b/book/workflows/githubtemplate.md @@ -43,9 +43,7 @@ This page shows you how as an example how to start your own Jupyter Book and hos ```{figure} figures/action.png :name: action ``` -5. When the workflow has finished, visit your build book at `https://.github.io/` (case sensitive). For our example it is [https://dummydocent.github.io/test_book_from_template/](https://dummydocent.github.io/test_book_from_template/) for the shown repository. - -To learn more about how we do this, please see the [GitHub Actions documentation](https://docs.github.com/en/actions) and our deployment pipeline configuration file `.github/workflows/deploy-book-ghpages.yml` [here](https://github.com/TeachBooks/template/blob/main/.github/workflows/deploy-book-ghpages.yml). +5. When the workflow has finished, visit your build book at `https://.github.io/` (case sensitive). For our example it is [https://dummydocent.github.io/test_book_from_template/](https://dummydocent.github.io/test_book_from_template/) for the shown repository. ````