You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-22Lines changed: 23 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,41 +1,42 @@
1
-
# GitHub workflow to publish online to GitHub Pages
1
+
# GitHub workflow: publish your book online to GitHub Pages
2
2
3
3
```{admonition} User types
4
4
:class: tip
5
5
This page is useful for user type 3, 4 and 5.
6
6
```
7
7
8
-
We developed a workflow which builds the TeachBooks in your repository for all branches, and publishes them online via GitHub Pages.
8
+
We developed a workflow which builds your TeachBook in your repository for all branches and publishes them online via GitHub Pages. In simplified terms, it builds the website based on your repository.
9
9
10
-
It has the following features:
10
+
The [TeachBooks Template](https://github.com/TeachBooks/template) uses this functionality for example. The workflow `call-deploy-book.yml` calls the `deploy-book.yml` workflow, which builds the Jupyter books at the calling repository for all branches, and deploys them via GitHub Pages.
11
+
12
+
The workflow has the following features:
11
13
- Publishing of your [TeachBook](https://teachbooks.tudelft.nl/)-repository (built with [Jupyter Book](https://github.com/executablebooks/jupyter-book)) to GitHub Pages
12
-
- Publishes both private (GitHub Pro, GitHub Team, GitHub Enterprise Cloud, or GitHub Enterprise Server required) and public (GitHub Free is enough) repositories. GitHub Teams is free for teacher as described in the [GitHub documentation](https://docs.github.com/en/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-education-for-teachers/about-github-education-for-teachers#github-education-features-for-teachers). If you’ve a organization for your TeachBook on GitHub, link your GitHub team rights to your organization as described on the [GitHub website](https://github.com/team#organizations).
13
-
- Publishing all or a selection of branches, allowing to build draft version of the TeachBook online preventing local builds
14
-
- A summary describing where the TeachBook is published, errors in the build process per branch and how the publish step is configured
15
-
- Caching of build books so that it can be reused when another branch is published or the next build contains critical errors
14
+
- Ability to publish both private (GitHub Pro, GitHub Team, GitHub Enterprise Cloud, or GitHub Enterprise Server required) and public (GitHub Free is enough) repositories.
15
+
GitHub Teams is free for teachers as described in the [GitHub documentation](https://docs.github.com/en/education/explore-the-benefits-of-teaching-and-learning-with-github-education/github-education-for-teachers/about-github-education-for-teachers#github-education-features-for-teachers).
16
+
If you have an organization for your TeachBook on GitHub, link your GitHub team rights to your organization as described on the [GitHub website](https://github.com/team#organizations).
17
+
- Publishing all or a selection of branches, allowing to build a draft version of the TeachBook online which reduces the need for local builds of the book
18
+
- Provides a summary describing where the TeachBook is published, errors in the build process per branch and how the publish step is configured
19
+
- Caching of already built books so that it can be partially reused when another branch is published or the next build contains critical errors
16
20
- Caching of python environment to speed up the workflow
17
21
- Allowing to use submodules within your book
18
22
- Customizable trigger for the workflow itself
19
23
- Optionally preprocess branches using the [`teachbooks` package](https://github.com/TeachBooks/TeachBooks).
20
24
- Converting branch-names to well-defined URLs
21
-
- Customizable settings on where the books should be deployed including alias for branch-names and selection of one branch to be deployed on root. The workflow will gives warnings if these setting are ill-defined or conflicting. Although aliases are not allowed by GitHub Pages, it seems you can use one alias, but not more.
22
-
- Redirects the root directory to one of the branches or copy one of the branches to root.
25
+
- Customizable settings on where the books should be deployed including alias for branch-names and selection of one branch to be deployed on root. The workflow will gives warnings if these settings are ill-defined or conflicting. Although aliases are not allowed by GitHub Pages, it seems you can use one alias, but not more.
26
+
- Redirects the root directory to one of the branches or copies one of the branches to root.
23
27
- Adds an 'archived'-banner to old branches / branches of previous years.
24
28
25
-
The [TeachBooks template book](https://github.com/TeachBooks/template) uses this functionality for example: The workflow `call-deploy-book.yml` calls the `deploy-book.yml` workflow, which builds the Jupyter books at the calling repository for all branches, and deploys them via GitHub Pages.
26
-
27
29
## How to start using this workflow
28
-
This workflow is used in `TeachBooks/template`. Feel free to use it for your TeachBook as well:
30
+
As previously mentioned, this workflow is used in `TeachBooks/template`. Feel free to use it for your TeachBook as well:
29
31
1. Add [`teachbooks`](https://github.com/TeachBooks/TeachBooks) to your `requirements.txt` file in your root folder
30
32
2. Move all the TeachBook files (including `_config.yml` and `_toc.yml`) to a subdirectory `book/`.
31
-
3. Copy the [`call-deploy-book.yml` workflow](https://github.com/TeachBooks/deploy-book-workflow/blob/main/.github/workflows/call-deploy-book.yml) to the `/.github/workflows` folder in your repository.
33
+
3. Copy the [`call-deploy-book.yml`](https://github.com/TeachBooks/deploy-book-workflow/blob/main/.github/workflows/call-deploy-book.yml) workflow to the `/.github/workflows` folder in your repository.
## Customize the workflow: TeachBook publishing settings
39
40
40
41
You can adapt the behaviour by setting repository variables as explained [here](https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-a-repository) or using the [VS Code Extension GitHub Actions](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-github-actions). Define the following repository variables:
41
42
-`PRIMARY_BRANCH` which is set to `main` whenever it's not defined in the repository variables.
@@ -44,26 +45,26 @@ You can adapt the behaviour by setting repository variables as explained [here](
44
45
-`BEHAVIOR_PRIMARY` which is set to `redirect` whenever it's not defined in the repository variables.
45
46
- This indicates whether to copy the PRIMARY_BRANCH to root ('copy') or redirect from root to the PRIMARY_BRANCH ('redirect')
46
47
- Advised to use 'redirect' if you expect to archive a version in the future so that the URL doesn't change for the reader.
47
-
-`BRANCH_ALIASES` which is set to ``(space) whenever it's not defined in the repository variables.
48
+
-`BRANCH_ALIASES` which is set to `` (just a space) whenever it's not defined in the repository variables.
48
49
- This defines an alias (custom URL) for a branch
49
-
-Variable should be an Space-separated list of branch names, e.g. 'alias:really-long-branch-name`
50
-
- If no alias is wanted, `BRANCH_ALIASES` may be set to ' ' (space).
50
+
-Variables should be a space-separated list of branch names, e.g. 'alias:really-long-branch-name`
51
+
- If no alias is wanted, `BRANCH_ALIASES` may be set to `` (just a space)
51
52
-`BRANCHES_TO_DEPLOY` which is set to `*` (all branches) whenever it's not defined in the repository variables.
52
53
- This defines the branches to deploy.
53
54
- It should be a space-separated list of branch names, e.g. 'main second third'.
54
-
-`BRANCHES_TO_PREPROCESS` which is to to `` (space, no branch) whenever it's not defined in the repository variables
55
+
-`BRANCHES_TO_PREPROCESS` which is to to `` (just a space = no branch) whenever it's not defined in the repository variables
55
56
- This defines the branches to preprocess with the [`TeachBooks` package](https://teachbooks.github.io/TeachBooks/cli/cli.html#cmdoption-teachbooks-build-publish), which removed book-pages and config lines defined with `# START REMOVE FROM PUBLISH` and `# END REMOVE FROM PUBLISH`
56
57
- It should be a space-separated list of branch names, e.g. 'main second third'.
57
58
- If no preprocessing is required, `BRANCH_TO_PREPROCESS` may be set to ' ' (space).
58
59
-`BRANCHES_ARCHIVED` which is set to `` (space, no branch) whenever it's not defined in the repository variables
59
60
- This adds a banner to the published branch: You are viewing an archived version of the book. Click here for the latest version.
60
61
- It should be a space-separate list of branch names, e.g. 'main second third'.
61
62
62
-
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.
63
+
In `call-deploy-book.yml` itself you can specify the trigger for this workflow. By default, a push to any branch triggers the workflow. You can limit the branches or subdirectories.
63
64
64
-
## Workflow progress and summary
65
+
## View the workflow progress and summary
65
66
66
-
Whenever the workflow is triggered, progress and a summary can be seen under the <svgaria-hidden="true"height="16"viewBox="0 0 16 16"version="1.1"width="16"data-view-component="true"class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <pathd="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg>`Actions`- `All workflows` - `call-deploy-book` in GitHub. It shows you a descriptive summary:
67
+
Whenever the workflow is triggered, its progress and a summary can be seen under the <svgaria-hidden="true"height="16"viewBox="0 0 16 16"version="1.1"width="16"data-view-component="true"class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <pathd="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg>`Actions`- `All workflows` - `call-deploy-book` in GitHub! It shows you a descriptive summary:
67
68
- Ill-defined repository configuration variables (in `Annotations`)
68
69
- Which branches are published and where (`https://<username/organization_name>.github.io/<repository_name>` (case sensitive)) including which branch is published on the website root and the applied alias
0 commit comments