Skip to content

Commit 0c498b4

Browse files
authored
added instructions for checking out and updating specific releases (#6095)
* added instructions for checking out specific releases and also moved the bit about $GH_TOKEN to a place above the pip install instructions * separated out update instructions, revised git instructions * bumped version number that insiders is based on * removed --upgrade from update command * made insiders changelog a section * changed instructions for upgrading via git
1 parent b777690 commit 0c498b4

File tree

5 files changed

+105
-34
lines changed

5 files changed

+105
-34
lines changed

docs/insiders/changelog.md renamed to docs/insiders/changelog/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Changelog
21

32
## Material for MkDocs Insiders
43

docs/insiders/getting-started.md

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,38 @@ your GitHub account in order to access the Insiders repository programmatically
3030
[Generate a new token]: https://github.com/settings/tokens/new
3131
[scopes]: https://docs.github.com/en/developers/apps/scopes-for-oauth-apps#available-scopes
3232

33+
Some of the instructions below require that the `GH_TOKEN` environment
34+
variable is set to the value of the personal access token you
35+
generated in the previous step. Note that the personal access token
36+
must be kept secret at all times, as it allows the owner to access
37+
your private repositories.
38+
3339
## Installation
3440

3541
### with pip
3642

37-
Material for MkDocs Insiders can be installed with `pip`:
43+
Material for MkDocs Insiders can be installed with `pip`. You will
44+
normally want to install the latest release but can also install a
45+
specific older release or even the latest development version.
46+
Make sure you have the `GH_TOKEN` variable set as instructed above.
3847

39-
``` sh
40-
pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
41-
```
48+
=== "Specific release"
49+
50+
Pick the corresponding tag from the [list of tags] for the Insiders
51+
repository. In the `pip` command below, replace the tag at the
52+
end of the URL with the one you want.
53+
54+
``` sh
55+
pip install git+https://${GH_TOKEN}@github.com/squidfunk/[email protected]
56+
```
4257

43-
The `GH_TOKEN` environment variable must be set to the value of the personal
44-
access token you generated in the previous step. Note that the personal access
45-
token must be kept secret at all times, as it allows the owner to access your
46-
private repositories.
58+
=== "Latest"
59+
60+
``` sh
61+
pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
62+
```
63+
64+
[list of tags]: https://github.com/squidfunk/mkdocs-material-insiders/tags
4765

4866
### with docker
4967

@@ -129,27 +147,6 @@ pip install -e mkdocs-material
129147
[Pull App]: https://github.com/apps/pull
130148
[publish]: https://github.com/squidfunk/mkdocs-material-insiders/blob/master/.github/workflows/publish.yml
131149

132-
## Upgrading
133-
134-
When upgrading Insiders, you should always check the version of Material for
135-
MkDocs which makes up the first part of the version qualifier, e.g.Insiders
136-
`4.x.x` is currently based on `8.x.x`:
137-
138-
```
139-
8.x.x-insiders-4.x.x
140-
```
141-
142-
If the major version increased, it's a good idea to consult the [upgrade
143-
guide] and go through the steps to ensure your configuration is up to date and
144-
all necessary changes have been made. If you installed Insiders via `pip`, you
145-
can upgrade your installation with the following command:
146-
147-
```
148-
pip install --upgrade git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
149-
```
150-
151-
[upgrade guide]: ../upgrade.md
152-
153150
## Built-in plugins
154151

155152
When you're using built-in plugins that are solely available via Insiders,

docs/insiders/upgrade.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# How to upgrade
2+
3+
When upgrading Insiders, you should always check the version of Material for
4+
MkDocs which makes up the first part of the version qualifier, e.g., Insiders
5+
`4.x.x` is currently based on `9.x.x`:
6+
7+
```
8+
9.x.x-insiders-4.x.x
9+
```
10+
11+
If the major version increased, it's a good idea to consult the [upgrade
12+
guide] and go through the steps to ensure your configuration is up to date and
13+
all necessary changes have been made.
14+
15+
[upgrade guide]: ../upgrade.md
16+
[list of tags]: https://github.com/squidfunk/mkdocs-material-insiders/tags
17+
18+
Depending on how you installed and what you want to upgrade to you
19+
need to run different commands:
20+
21+
=== "pip upgrade to release"
22+
23+
If you installed Insiders via `pip` and you want to upgrade to a
24+
specific release, pick the tag from the [list of tags] and replace
25+
the tag at the end of the URL of the command given below:
26+
27+
```
28+
pip install --upgrade git+https://${GH_TOKEN}@github.com/squidfunk/[email protected]
29+
```
30+
31+
=== "pip upgrade to latest development"
32+
33+
If you installed Insiders via `pip` and want to upgrade to the
34+
latest development version, run:
35+
36+
```
37+
pip install --upgrade git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
38+
```
39+
40+
=== "git upgrade"
41+
42+
If you installed Insiders via `git`, you will first need to check
43+
out the version you want to install into your workspace. After
44+
this is done, you can run `pip` to install that version.
45+
46+
First, make sure that your local clone is up-to-date with the
47+
upstream repository by running `git pull`.
48+
49+
You can look up the tags using `git tag --sort -refname` or you
50+
can consult the [list of tags]. Then, checkout the tag you want to
51+
use by replacing the one given in the command below (twice)and running
52+
it from your workspace[^detached]:
53+
54+
[^detached]:
55+
The `--detach` argument serves to tell `git` that you are ok to
56+
have your workspace in the [detached head] state, which is
57+
perfectly fine to have here.
58+
59+
[detached head]: https://www.git-tower.com/learn/git/faq/detached-head-when-checkout-commit/
60+
61+
```
62+
cd mkdocs-material
63+
git checkout --detach tags/9.4.2-insiders-4.42.0
64+
```
65+
66+
Now, change back to the parent directory in which your Git
67+
repository lives and run `pip`:
68+
69+
```
70+
cd ..
71+
pip install -e mkdocs-material
72+
```
73+
74+

mkdocs.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,9 @@ nav:
252252
- Tooltips: reference/tooltips.md
253253
- Insiders:
254254
- insiders/index.md
255-
- Getting started:
256-
- Installation: insiders/getting-started.md
257-
- Changelog: insiders/changelog.md
255+
- Getting started: insiders/getting-started.md
256+
- Changelog:
257+
- insiders/changelog/index.md
258+
- How to upgrade: insiders/upgrade.md
258259
- Blog:
259260
- blog/index.md

src/overrides/hooks/shortcodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def _badge_for_version(text: str, page: Page, files: Files):
145145
# Create badge for version of Insiders
146146
def _badge_for_version_insiders(text: str, page: Page, files: Files):
147147
spec = text.replace("insiders-", "")
148-
path = f"insiders/changelog.md#{spec}"
148+
path = f"insiders/changelog/index.md#{spec}"
149149

150150
# Return badge
151151
icon = "material-tag-heart-outline"

0 commit comments

Comments
 (0)