mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-24 07:30:12 +01:00
Update cache key creation to use date suffix
This commit is contained in:
parent
308afb9945
commit
811a0739b4
5
.github/workflows/documentation.yml
vendored
5
.github/workflows/documentation.yml
vendored
@ -46,11 +46,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
|
||||||
|
- name: Set the date environmental variable
|
||||||
|
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Set up build cache
|
- name: Set up build cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
id: cache
|
id: cache
|
||||||
with:
|
with:
|
||||||
key: mkdocs-material-${{ github.ref }}
|
key: mkdocs-material-${{ env.cache_id }}
|
||||||
path: .cache
|
path: .cache
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
mkdocs-material-
|
mkdocs-material-
|
||||||
|
@ -38,9 +38,10 @@ contents:
|
|||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: 3.x
|
python-version: 3.x
|
||||||
|
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV # (3)!
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
key: mkdocs-material-${{ github.ref }} # (3)!
|
key: mkdocs-material-${{ env.cache_id }}
|
||||||
path: .cache
|
path: .cache
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
mkdocs-material-
|
mkdocs-material-
|
||||||
@ -53,8 +54,14 @@ contents:
|
|||||||
2. At some point, GitHub renamed `master` to `main`. If your default branch
|
2. At some point, GitHub renamed `master` to `main`. If your default branch
|
||||||
is named `master`, you can safely remove `main`, vice versa.
|
is named `master`, you can safely remove `main`, vice versa.
|
||||||
|
|
||||||
3. The `github.ref` property assures that the cache will
|
3. Store the `cache_id` environmental variable to access it later during cache
|
||||||
update on each pull request merge.
|
`key` creation. The name is case-sensitive, so be sure to align it with `${{ env.cache_id }}`.
|
||||||
|
|
||||||
|
- The `--utc` option makes sure that each workflow runner uses the same time zone.
|
||||||
|
- The `%V` format assures a cache update once a week.
|
||||||
|
- You can change the format to `%F` to have daily cache updates.
|
||||||
|
|
||||||
|
You can read the [manual page] to learn more about the formatting options of the `date` command.
|
||||||
|
|
||||||
4. This is the place to install further [MkDocs plugins] or Markdown
|
4. This is the place to install further [MkDocs plugins] or Markdown
|
||||||
extensions with `pip` to be used during the build:
|
extensions with `pip` to be used during the build:
|
||||||
@ -86,9 +93,10 @@ contents:
|
|||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: 3.x
|
python-version: 3.x
|
||||||
|
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
key: mkdocs-material-${{ github.ref }}
|
key: mkdocs-material-${{ env.cache_id }}
|
||||||
path: .cache
|
path: .cache
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
mkdocs-material-
|
mkdocs-material-
|
||||||
@ -123,6 +131,7 @@ Your documentation should shortly appear at `<username>.github.io/<repository>`.
|
|||||||
[built-in optimize plugin]: setup/building-an-optimized-site.md#built-in-optimize-plugin
|
[built-in optimize plugin]: setup/building-an-optimized-site.md#built-in-optimize-plugin
|
||||||
[GitHub secrets]: https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
|
[GitHub secrets]: https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
|
||||||
[publishing source branch]: https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site
|
[publishing source branch]: https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site
|
||||||
|
[manual page]: https://man7.org/linux/man-pages/man1/date.1.html
|
||||||
|
|
||||||
### with MkDocs
|
### with MkDocs
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ carried out. You might want to:
|
|||||||
`.cache` directory in between builds. Taking the example from the
|
`.cache` directory in between builds. Taking the example from the
|
||||||
[publishing guide], add the following lines:
|
[publishing guide], add the following lines:
|
||||||
|
|
||||||
``` yaml hl_lines="15-20"
|
``` yaml hl_lines="15-21"
|
||||||
name: ci
|
name: ci
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -509,9 +509,10 @@ carried out. You might want to:
|
|||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: 3.x
|
python-version: 3.x
|
||||||
|
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
key: mkdocs-material-${{ github.ref }}
|
key: mkdocs-material-${{ env.cache_id }}
|
||||||
path: .cache
|
path: .cache
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
mkdocs-material-
|
mkdocs-material-
|
||||||
|
Loading…
Reference in New Issue
Block a user