Skip to content

Commit

Permalink
Upgrade mike to 2.0.0
Browse files Browse the repository at this point in the history
This commit upgrades `mike` to 2.0.0. This new version uses symlinks
for aliases by default, but they are not supported by GitHub Pages, so
we need to use the `redirect` alias type instead explicitly.

We use the new `alias_type` option in the `mike` plugin configuration
in the `mkdocs.yml` file to set the alias type to `redirect`.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
  • Loading branch information
llucax committed Nov 6, 2023
1 parent 39fa7ff commit 326e029
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 27 deletions.
61 changes: 41 additions & 20 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,49 @@

## Summary

<!-- Here goes a general summary of what this release is about -->
This release upgrades `mike` to 2.0.0.

## Upgrading

<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->

### Cookiecutter template

<!-- Here upgrade steps for cookiecutter specifically -->

## New Features

<!-- Here goes the main new features and examples or instructions on how to use them -->

### Cookiecutter template

<!-- Here new features for cookiecutter specifically -->

## Bug Fixes

<!-- Here goes notable bug fixes that are worth a special mention or explanation -->

### Cookiecutter template

<!-- Here bug fixes for cookiecutter specifically -->
There is no need to re-generate the cookiecutter template for this release. Instead you can upgrade the `mike` package in your `pyproject.toml` file and add the new `alias_type: redirect` option to the `plugins.mike` key in the `mkdocs.yml` file.

You should be able to do this by running the following commands:

```sh
sed -i '/canonical_version: latest/ i\ alias_type: redirect' mkdocs.yml
sed -i 's/ "mike == .*",/ "mike == 2.0.0",/' pyproject.toml
```

Please make sure to check the diff and test if everything works as expected. After doing a `git diff` you should get something like:

```diff
diff --git a/mkdocs.yml b/mkdocs.yml
index 3d0f82e..6adfbe8 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -93,6 +93,7 @@ plugins:
- literate-nav:
nav_file: SUMMARY.md
- mike:
+ alias_type: redirect
canonical_version: latest
- mkdocstrings:
custom_templates: templates
diff --git a/pyproject.toml b/pyproject.toml
index 9a1604b..b183524 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -47,7 +47,7 @@ dev-formatting = ["black == 23.10.1", "isort == 5.12.0"]
dev-mkdocs = [
"black == 23.10.1",
"Markdown==3.5.1",
- "mike == 1.1.2",
+ "mike == 2.0.0",
"mkdocs-gen-files == 0.5.0",
"mkdocs-literate-nav == 0.6.1",
"mkdocs-material == 9.4.7",
```

If that's not the case, your `pyproject.toml` and/or `mkdocs.yml` files might have been diverged from the generated files and updated in a way that is not compatible with the upgrade. In that case you'll have to fix it manually or re-generate the templates.
1 change: 1 addition & 0 deletions cookiecutter/{{cookiecutter.github_repo_name}}/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ plugins:
- literate-nav:
nav_file: SUMMARY.md
- mike:
alias_type: redirect
canonical_version: latest
- mkdocstrings:
custom_templates: templates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ dev-formatting = ["black == 23.9.1", "isort == 5.12.0"]
dev-mkdocs = [
"black == 23.9.1",
"Markdown==3.4.4",
"mike == 1.1.2",
"mike == 2.0.0",
"mkdocs-gen-files == 0.5.0",
"mkdocs-literate-nav == 0.6.1",
"mkdocs-macros-plugin == 1.0.4",
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ plugins:
- literate-nav:
nav_file: SUMMARY.md
- mike:
alias_type: redirect
canonical_version: latest
- mkdocstrings:
custom_templates: templates
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ dev-formatting = ["black == 23.9.1", "isort == 5.12.0"]
dev-mkdocs = [
"black == 23.9.1",
"Markdown==3.4.4",
"mike == 1.1.2",
"mike == 2.0.0",
"mkdocs-gen-files == 0.5.0",
"mkdocs-literate-nav == 0.6.1",
"mkdocs-macros-plugin == 1.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ plugins:
- literate-nav:
nav_file: SUMMARY.md
- mike:
alias_type: redirect
canonical_version: latest
- mkdocstrings:
custom_templates: templates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dev-formatting = ["black == 23.9.1", "isort == 5.12.0"]
dev-mkdocs = [
"black == 23.9.1",
"Markdown==3.4.4",
"mike == 1.1.2",
"mike == 2.0.0",
"mkdocs-gen-files == 0.5.0",
"mkdocs-literate-nav == 0.6.1",
"mkdocs-macros-plugin == 1.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ plugins:
- literate-nav:
nav_file: SUMMARY.md
- mike:
alias_type: redirect
canonical_version: latest
- mkdocstrings:
custom_templates: templates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dev-formatting = ["black == 23.9.1", "isort == 5.12.0"]
dev-mkdocs = [
"black == 23.9.1",
"Markdown==3.4.4",
"mike == 1.1.2",
"mike == 2.0.0",
"mkdocs-gen-files == 0.5.0",
"mkdocs-literate-nav == 0.6.1",
"mkdocs-macros-plugin == 1.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ plugins:
- literate-nav:
nav_file: SUMMARY.md
- mike:
alias_type: redirect
canonical_version: latest
- mkdocstrings:
custom_templates: templates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dev-formatting = ["black == 23.9.1", "isort == 5.12.0"]
dev-mkdocs = [
"black == 23.9.1",
"Markdown==3.4.4",
"mike == 1.1.2",
"mike == 2.0.0",
"mkdocs-gen-files == 0.5.0",
"mkdocs-literate-nav == 0.6.1",
"mkdocs-macros-plugin == 1.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ plugins:
- literate-nav:
nav_file: SUMMARY.md
- mike:
alias_type: redirect
canonical_version: latest
- mkdocstrings:
custom_templates: templates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dev-formatting = ["black == 23.9.1", "isort == 5.12.0"]
dev-mkdocs = [
"black == 23.9.1",
"Markdown==3.4.4",
"mike == 1.1.2",
"mike == 2.0.0",
"mkdocs-gen-files == 0.5.0",
"mkdocs-literate-nav == 0.6.1",
"mkdocs-macros-plugin == 1.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ plugins:
- literate-nav:
nav_file: SUMMARY.md
- mike:
alias_type: redirect
canonical_version: latest
- mkdocstrings:
custom_templates: templates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dev-formatting = ["black == 23.9.1", "isort == 5.12.0"]
dev-mkdocs = [
"black == 23.9.1",
"Markdown==3.4.4",
"mike == 1.1.2",
"mike == 2.0.0",
"mkdocs-gen-files == 0.5.0",
"mkdocs-literate-nav == 0.6.1",
"mkdocs-macros-plugin == 1.0.4",
Expand Down

0 comments on commit 326e029

Please sign in to comment.