mirror of
https://github.com/TeachBooks/manual.git
synced 2026-11-12 22:35:51 +00:00
Merge pull request #114 from TeachBooks/versioning
Add section on versioning using Git tooling
This commit is contained in:
commit
d973abb2e2
10 changed files with 181 additions and 17 deletions
|
|
@ -30,6 +30,10 @@ parts:
|
|||
- file: workflows/merge_request.md
|
||||
- file: installation-and-setup/collab
|
||||
- file: installation-and-setup/versioning
|
||||
sections:
|
||||
- file: installation-and-setup/versions_URLs
|
||||
- file: installation-and-setup/versioning_changelog
|
||||
- file: installation-and-setup/publisher
|
||||
- file: installation-and-setup/copyright.md
|
||||
sections:
|
||||
- file: installation-and-setup/copyright/considerations
|
||||
|
|
@ -59,6 +63,7 @@ parts:
|
|||
- file: features/local_server
|
||||
- file: external/Nested-Books/README.md
|
||||
- file: features/update_env
|
||||
- file: features/versioning
|
||||
- file: features/sphinx_extensions.md
|
||||
sections:
|
||||
- file: external/Download-Link-Replacer/README.md
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ The following pages contain content written by others, part of has been reused a
|
|||
- Pages {ref}`copyright` and {ref}`copyright_considerations` include text from {cite:t}`tud_cip_24` that is used in the copyright checklist items. Original content licensed under CC BY.
|
||||
- Page {ref}`copyright_licenses`: {numref}`Figure %s<fig_license_types>` is included unmodified, along with paraphrased and quoted text (including hyperlinks) from {cite:t}`hall21`. Work is licensed under CC BY.
|
||||
- Page {ref}`copyright_licenses`: {numref}`Figure %s<fig_license_compatibility>` is included unmodified. Work is provided by Kennisland under a CC0 license. Accessed at [](https://wiki.creativecommons.org/wiki/File:CC_License_Compatibility_Chart.png) on December 17, 2024.
|
||||
- page [](./features/versioning.md): includes text from {cite:t}`semver` that has been modified. Original content licensed under CC BY 3.0.
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
38
book/features/versioning.md
Normal file
38
book/features/versioning.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# TeachBooks Versioning
|
||||
|
||||
> This page reuses adapted CC BY 3.0 content from Tom Preston-Werner {cite:t}`semver`. {fa}`quote-left`{ref}`Find out more here.<external_resources>`
|
||||
|
||||
Inspired by versioning systems in software management (i.e. semantic and CalVer versioning) TeachBooks suggests a versioning guideline in which the version number tells the reader about the impact of the change. This might more suitable for your online books than the more traditional way of versioning paper books (version 1, 2, etc.), because of the amount of edits which online books allow. We recommend TeachBooks versioning, which comes in two flavors:
|
||||
|
||||
1. `academic_year.additions.errata` versioning for books tailed-made for courses in which content is added / adapted during the course and might be restructured extensively every year while remaining to be available in the original form.
|
||||
2. `major.errata` versioning for books which are more stable over years, in which big changes are covered only by the version number.
|
||||
|
||||
We have come up with guidelines how to use the two TeachBooks-versioning options (adapted from {cite:p}`semver`):
|
||||
|
||||
`````{tab-set}
|
||||
````{tab-item} academic_year.additions.errata
|
||||
1. A normal version number MUST take the form `academic_year.additions.errata` where `academic_year` is the academic year in which the book is used, and `additions`, and `errata` are non-negative integers, and MUST NOT contain leading zeroes. Each element MUST increase numerically. For instance: 2025.9.0 -> 2025.10.0 -> 2025.11.0
|
||||
2. Once a versioned book has been released, the contents of that version MUST NOT be modified. Any modifications MUST be released as a new version.
|
||||
3. Errata versions MUST be incremented if a small change is made which should be communicated to the reader in both the source code and in the book itself. If the small change is not crucial (like a simple typo), you might consider not defining it as a new version but combining it with other changes in the next errata or additions version.
|
||||
4. Additions version MUST be incremented if an addition is made to the book. It MUST be communicated in both the source code and in the book itself. It MAY include errata level changes. The errata version MUST be reset to 0 when the addition version is incremented.
|
||||
5. Academic year version MUST be incremented if a fresh book is started for which additions will follow later. It MUST be communicated in both the source code and in the book itself. Additions and errata versions MUST be reset to 0 when academic version is incremented.
|
||||
6. Precedence refers to how versions are compared to each other when ordered.
|
||||
1. Precedence MUST be calculated by separating the version into academic year, additions and errata identifiers in that order.
|
||||
2. Precedence is determined by the first difference when comparing each of these identifiers from left to right as follows: Academic year, additions and errata versions are always compared numerically. Example: 2024.0.0 < 2025.0.0 < 2025.1.0 < 2025.1.1.
|
||||
7. The way in which the version number is incremented after the initial release should be explained in the README of the source code and in the book itself.
|
||||
|
||||
An example can be seen in [the source repository of the Engineering Systems Optimization book](https://github.com/TUDelft-books/CME4501/tags) showing tags for different versions.
|
||||
````
|
||||
````{tab-item} major.errata
|
||||
1. A normal version number MUST take the form `major.errata` where `major`, and `errata` are non-negative integers, and MUST NOT contain leading zeroes. Each element MUST increase numerically. For instance: 9.0 -> 10.0 -> 11.0
|
||||
2. Once a versioned book has been released, the contents of that version MUST NOT be modified. Any modifications MUST be released as a new version.
|
||||
3. Errata versions MUST be incremented if a small change is made which should be communicated to the reader in both the source code and in the book itself. If the small change is not crucial (like a simple typo), you might consider not defining it as a new version but combining it with other changes in the next major version.
|
||||
5. Major versions MUST be incremented if a substantial restructure or additions is made. It MUST be communicated in both the source code and in the book itself. Errata versions MUST be reset to 0 when the major version is incremented.
|
||||
6. Precedence refers to how versions are compared to each other when ordered.
|
||||
1. Precedence MUST be calculated by separating the version into major and errata identifiers in that order.
|
||||
2. Precedence is determined by the first difference when comparing each of these identifiers from left to right as follows: major and errata versions are always compared numerically. Example: 1.0 < 2.0 < 2.1.
|
||||
7. The way in which the version number is incremented after the initial release should be explained in the README of the source code and in the book itself.
|
||||
````
|
||||
`````
|
||||
|
||||
Read [](../installation-and-setup/versioning_changelog.md) on how to combine this with a changelog, tags and releases!
|
||||
|
|
@ -15,6 +15,7 @@ Furthermore, establish a clear editing and review process.
|
|||
|
||||
For the editing process, establish some practical rules on whether to use issues, branches and forks for adding content, fixing typos or making other changes. Furthermore, it can help to write down when you expect (draft) merge/pull requests and how to use the assign and review options in GitHub/GitLab. It is advisable to have at least a maintainer review each piece of content to maintain quality and consistency. Provide explanation on how you organize the book-editing and how you'd like to receive feedback in both the readme as the published book. The use of the [repository button {fa}`fa-github`, suggest edit {fa}`pencil` and issue button {fa}`lightbulb`](https://jupyterbook.org/en/stable/basics/repository.html) is advised.
|
||||
|
||||
(draft_book)=
|
||||
## Define draft version of book
|
||||
If there's many people working on different parts of the book and material is staged for publication to students, we recommend using at least two separate branches, one which is released to students, the other one for development. Using the [](../external/deploy-book-workflow/README.md), it's very easy to share multiple versions of your book on the same root-URL.
|
||||
|
||||
|
|
|
|||
BIN
book/installation-and-setup/figures/tags_github.png
Normal file
BIN
book/installation-and-setup/figures/tags_github.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
6
book/installation-and-setup/publisher.md
Normal file
6
book/installation-and-setup/publisher.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
# Publishing your book with a publisher
|
||||
You can choose to publish your online book with a publisher. This could increase findability of your book, but may have versioning, copyright and licensing consequences
|
||||
|
||||
For TU Delft employees, you can decide to publish via TU Delft OPEN interactive textbooks. Publishing will give you a copyright check, ISBN or DOI number, and registration in several shared databases but limits the amount of changes you can make to your book: for substantial changes a new published version is needed with an updated copyright checks. Small changes like typos can always be made, which are processed in the published version every hour.
|
||||
In case of editing a book for a course during that actual course and/or your book has limited value outside your course's content, we advise you only to publish an archived version of your book whenever the academic year is over.
|
||||
|
|
@ -5,27 +5,29 @@
|
|||
This page is useful for user type 4-5.
|
||||
```
|
||||
|
||||
Online books can be easily updated, however, this might confuse readers. Therefore, it's good practice to be aware of this and, where needed, provide explicit version to the readers. It's recommended to do this in multiple ways, which can be combined:
|
||||
- Publish versions on separate (fixed) URLs
|
||||
- Use some sort of semantic versioning with tags
|
||||
- Keep both source code as (export of) websites of archived versions
|
||||
- Publishing your book more officially
|
||||
Online books can be easily updated, however, this might confuse readers. Therefore, it's good practice to be aware of this and, where needed, provide an explicit version to the readers.
|
||||
|
||||
## Publish version on separate (fixed) URLs
|
||||
When making books for education, typically your book can change substantially for consequential academic years. Using the [](../external/deploy-book-workflow/README.md), you can release the different version of your book all under the same root URL. If you name each students' version of each year to the `<current academic year>`, the students URL includes that academic year too. It is recommended to yearly update the current academic year branch as the `PRIMARY BRANCH` when using the [GitHub workflow](gh-workflow-settings). This ensures that students are redirected to a consistent URL, even when new versions of the book are added later. Eventually, you can add old branches to the list of `BRANCHES_ARCHIVED` when using the [GitHub workflow](gh-workflow-settings) to include a banner on the page indicating its archived state.
|
||||
For example when making taylor-made books for specific academic years, you want students to be able to find their own book (even after the academic year is over). For students which take the course twice, you might want to provide some sort of changelog of what has been changed.
|
||||
|
||||
If you plan on maintaining only one public version, it is advisable to set `BEHAVIOR_PRIMARY` from the default `redirect` to `copy`. This ensures that the primary branch is copied to the root, making the URL more compact.
|
||||
Another example could be a book in which you add content and solutions during the course or you're fixing mistakes which may have misinformed the reader. If this is not directly visible in the table of contents, students might not be aware of these changes. Again, a changelog could be useful to inform the reader about the change. Furthermore, a smart versioning system might tell the reader something about the impact of the addition differentiating errata and additions.
|
||||
|
||||
Don't forget to explain how you organize these URLs in your README and eventually in the book itself too with a sentence like this:
|
||||
You could also think of your published book which is referenced by other people. Don't be afraid, git makes it very easy to make this possible. Git allows you to go back in the git history. To make this as easy as possible for readers, you can assign versions using TeachBooks versioning instead of having the readers scroll through a long list of (not alway very descriptive) commit descriptions.
|
||||
|
||||
> This is the 2024-2025-version of this book. Go to `<link to root URL>` to view the most recent version of this book, or adapt the year in `<link to root URL>/<year>` to the year when you took the course.
|
||||
Maybe this all sounds confusing and difficult. No worries! A use-case could be a book which progresses in time, but in which you don't want to deal with the additional hassle of versioning. Your book could be perfectly fine without any measures on this topic!
|
||||
|
||||
If you've many version of the book, at some point you might reach the 1 GB GitHub Pages limit. This is only expected for extremely large books with a lot of non-text-based (binary) content. To prevent going over that limit, store large content not used for building the website (like images) on an external server. This can be another GitHub repository or a (paid) object store
|
||||
If you are part of the previous group, but at some point decide to make a new version of the book while keeping the old one, you could do so without dealing with version numbers and changelogs. Just publish both versions online.
|
||||
|
||||
## Semantic versioning
|
||||
Finally, you might consider publishing your book at an online publisher. This could increase findability of your book and you might benefit from the brand of the publisher, but it may have flexibility, copyright and licensing consequences.
|
||||
|
||||
## Publishing your book with publisher
|
||||
You can choose to publish your online book with a publisher. This could increase findability of your book, but may have versioning, copyright and licensing consequences
|
||||
So, there's a few use-cases for which different (combinations) of solutions exist. These are summarized in the table below in order of increasingly effort and impact. You can combine use-cases to your liking:
|
||||
|
||||
For TU Delft employees, you can decide to publish via TU Delft OPEN interactive textbooks. Publishing will give you a copyright check, ISBN or DOI number, and registration in several shared databases but limits the amount of changes you can make to your book: for substantial changes a new published version is needed with an updated copyright checks. Small changes like typos can always be made, which are processed in the published version every hour.
|
||||
In case of editing a book for a course during that actual course and/or your book has limited value outside your course's content, we advise you only to publish an archived version of your book whenever the academic year is over.
|
||||
| Use-case | [Publish versions on separate URLs](./versions_URLs.md) | [Use TeachBooks versioning with a changelog](versioning_changelog) | [Publish your book with a publisher](./publisher.md) |
|
||||
|:---:|:---:|:---:|:---:|
|
||||
| Book changes over time, but you don't want to deal with versioning | | | |
|
||||
| Occasionally releasing a new version while keeping the previous version, with minimal effort for versioning | Recommended | | |
|
||||
| Continuously adding content and solutions or updating crucial mistakes | | Recommended | |
|
||||
| Allow referencing specific versions | Can be considered | Recommended | |
|
||||
| Taylor-made book per academic year | Recommended | Recommended in case of students retaking a course | |
|
||||
| Increase findability or benefit from publisher's brand | | | Recommended |
|
||||
|
||||
Read more about each of these measures on the following sub-pages.
|
||||
80
book/installation-and-setup/versioning_changelog.md
Normal file
80
book/installation-and-setup/versioning_changelog.md
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
# TeachBooks versioning with changelog
|
||||
|
||||
Versions combined with a changelog can be a very effective way to communicate book changes to the reader and allow reuse of specific versions. We recommend [TeachBooks versioning](../features/versioning.md), which comes in two flavors:
|
||||
|
||||
1. `academic_year.additions.errata` versioning for books tailed-made for courses in which content is added / adapted during the course and might be restructured extensively every year while remaining to be available in the original form. An example can be seen in [the source repository of the Engineering Systems Optimization book](https://github.com/TUDelft-books/CME4501/tags) showing tags for different versions.
|
||||
2. `major.errata` versioning for books which are more stable over years, in which big changes are covered only by the version number.
|
||||
|
||||
The details of TeachBooks versioning are covered [here](../features/versioning.md)
|
||||
|
||||
## Changelog
|
||||
To communicate changes, we advise creating a changelog in the book. The [template](https://github.com/TeachBooks/template/blob/main/book/changelog.md) contains an empty changelog to fill:
|
||||
|
||||
```md
|
||||
# Changelog
|
||||
|
||||
## `<latest version>`: `<date>`
|
||||
- `<Added/modified/deleted>` [](`<relative link to changed file>`)
|
||||
- ...
|
||||
- Full Changelog: `[<previous version>...<current version>](<link to diff as provided by GitHub>)'
|
||||
|
||||
## `<previous version>`: <...>
|
||||
- <...>
|
||||
|
||||
<...>
|
||||
```
|
||||
|
||||
An example can be found [here](https://ciem5000-2025.github.io/book/changelog.html)
|
||||
|
||||
## Note on version change on page
|
||||
When making errata changes or additions, it's advised to notify the reader not only in the changelog, but also on the relevant pages. You can do so using the `versionadded` and `versionchanged` admonitions:
|
||||
|
||||
```md
|
||||
::::::{versionchanged} <version_number> <date of version release>
|
||||
<explanation of change on current page>
|
||||
::::::
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```md
|
||||
::::::{versionadded} <version_number> <date of version release>
|
||||
<explanation of addition on/of current page>
|
||||
::::::
|
||||
```
|
||||
|
||||
Leads to for example:
|
||||
::::::{versionchanged} v2025.3.5 2025-02-23
|
||||
TeachBooks versioning added
|
||||
::::::
|
||||
|
||||
An example can be found [here](https://oit.tudelft.nl/CME4501/2024/pages/linear_constrained_optimization_class.html)
|
||||
|
||||
## Implement tags and releases
|
||||
Tags can be added to your source code by adding the version number as a tag to a specific commit.
|
||||
|
||||
You can do so in GitHub when creating a new release (on the `Code` page of your repository.) There, you can enter a name for your tag and select one of your branches or recent commits:
|
||||
|
||||
```{figure} figures/tags_github.png
|
||||
---
|
||||
width: 500px
|
||||
align: center
|
||||
---
|
||||
|
||||
```
|
||||
|
||||
Locally, you can do so in GitHub Desktop by clicking 'Create Tag...` for a specific commit in the History tab.
|
||||
|
||||
```{figure} figures/tags.png
|
||||
---
|
||||
width: 500px
|
||||
align: center
|
||||
---
|
||||
|
||||
```
|
||||
|
||||
Once the tags is pushed to GitHub/GitLab. You can create a release of the version by clicking `Release` on the `Code` page of your repository. There you can select a tag and generate release notes.
|
||||
|
||||
It's recommended to add the relevant part of the changelog to the release notes on GitHub. An example can be found [here](https://github.com/CIEM5000-2025/book/releases/tag/v2025.2.0)
|
||||
|
||||
|
||||
23
book/installation-and-setup/versions_URLs.md
Normal file
23
book/installation-and-setup/versions_URLs.md
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Publish version on separate (fixed) URLs
|
||||
|
||||
As soon as you have different versions online, you have to make a decision about URLs. Using the [](../external/deploy-book-workflow/README.md), you can release the different version of your book all under the same root URL. So, it uses the same workflow as used for draft versions of your book as describe [before](draft_book), the only difference being that URLs of draft versions are generally not shared publicly.
|
||||
|
||||
If you plan on maintaining only one public version, it is advisable to set `BEHAVIOR_PRIMARY` from the default `redirect` to `copy`. This ensures that the primary branch is copied to the root, making the URL more compact.
|
||||
|
||||
To share the built book / website of old versions for your book on GitHub you have a few options:
|
||||
- create a branch for each version. When doing this, [the GitHub workflow](../external/deploy-book-workflow/README.md) will build it on GitHub pages. Here's a few tips:
|
||||
- It's advised to use the version as branch name. In case of versions per academic year, you can just name each branch to the current academic year, this leads to the URL with the same name. In that case.
|
||||
- It is recommended to update the primary branch as the `PRIMARY BRANCH` when using the [GitHub workflow](gh-workflow-settings) whenever a new version is considered to be the most primary one. This ensures that readers are redirected to a consistent URL, even when new versions of the book are added later.
|
||||
- Eventually, you can add old branches to the list of `BRANCHES_ARCHIVED` when using the [GitHub workflow](gh-workflow-settings) to include a banner on the page indicating its archived state. Alternatively, you can add a banner manually to `_config.yml`, as explained [here](../basic-features/banner.md).
|
||||
- If you're using tags (as will be explained in [later](./versioning_changelog.md)), you can create a branch from a tag locally by running: `git branch <new_branch name> <tag/version>`.
|
||||
- If you have many version of the book, at some point you might reach the 1 GB GitHub Pages limit. This is only expected for extremely large books with a lot of non-text-based (binary) content. To prevent going over that limit, store large content not used for building the website (like images) on an external server. This can be another GitHub repository or a (paid) object store.
|
||||
- An example can be found in the book 'Engineering Systems Optimization': it has two versions for readers online, the [2023-version](https://oit.tudelft.nl/CME4501/2023) and the [2024-version](https://oit.tudelft.nl/CME4501/2024), recognizable by the URL. Both versions originate from their respective branches in the [GitHub-repository](https://github.com/TUDelft-books/CME4501)
|
||||
- add a zip of the built book to the release in GitHub as binary asset. This requires readers to download the zip and open the html files locally, but doesn't require you to host it somewhere. This zip can be easily downloaded as an artifact from [the GitHub action](../external/deploy-book-workflow/README.md). An example can be found [here](https://github.com/TUDelft-books/CME4501/releases/tag/v2024.1.0). Note that this requires you to set up tags and releases, as explained in [](versioning_changelog.md)
|
||||
- Use [Read the Docs](../features/pull_request_build.md) to build a website for all your branches, forks and tags as Read the docs doesn't have a 1 GB limit, but has a very different URL structure and the free community version has advertisement. In case you're using tags and releases, refer to the URL of this built from your GitHub release to make sure that GitHub visitors find their way to Read the Docs.
|
||||
|
||||
If you have your own webserver, you can publish each version on it manually.
|
||||
|
||||
Don't forget to explain how you organize your URLs and old versions in your README and eventually in the book itself too with a sentence like this (as can be seen in [this book](https://oit.tudelft.nl/CME4501/2024/intro.html) too):
|
||||
|
||||
> This is the `<version_number>`-version of this book. Go to `<link to root URL>` to view the most recent version of this book, or adapt the year in `<link to root URL>/<year>` to the year when you took the course.
|
||||
|
||||
|
|
@ -133,4 +133,12 @@
|
|||
url = {https://github.com/TeachBooks/Sphinx-Named-Colors},
|
||||
year = {2024},
|
||||
note = {Retrieved January 2025. MIT.}
|
||||
}
|
||||
}
|
||||
|
||||
@misc{semver,
|
||||
author = {Tom Preston-Werner},
|
||||
title = {Semantic Versioning specification},
|
||||
url = {https://semver.org/},
|
||||
year = {2025},
|
||||
note = {Retrieved February 2025. CC BY 3.0.}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue