Skip to content

Commit 2af3fbf

Browse files
committed
doc: add versioning
Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 71722f4 commit 2af3fbf

File tree

2 files changed

+29
-23
lines changed

2 files changed

+29
-23
lines changed

.github/workflows/docs.yml

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
push:
55
branches:
66
- doc
7+
- main
8+
tags:
9+
- 'v*'
710
paths:
811
- 'doc/**'
912
- 'mkdocs.yml'
@@ -16,22 +19,20 @@ on:
1619
- '.github/workflows/docs.yml'
1720

1821
permissions:
19-
contents: read
20-
pages: write
21-
id-token: write
22+
contents: write
2223

2324
concurrency:
24-
group: "pages"
25+
group: "docs-${{ github.ref }}"
2526
cancel-in-progress: false
2627

2728
jobs:
28-
build:
29+
docs:
2930
runs-on: ubuntu-latest
3031
steps:
3132
- name: Checkout
3233
uses: actions/checkout@v4
3334
with:
34-
fetch-depth: 0 # Needed for git-revision-date-localized plugin
35+
fetch-depth: 0
3536

3637
- name: Setup Python
3738
uses: actions/setup-python@v4
@@ -44,23 +45,25 @@ jobs:
4445
pipx inject mkdocs mkdocs-material
4546
pipx inject mkdocs pymdown-extensions
4647
pipx inject mkdocs mkdocs-callouts
48+
pipx inject mkdocs mike
49+
pipx list --verbose
50+
# Workaround, if pipx inject fails to install symlink
51+
ln -s "$HOME/.local/share/pipx/venvs/mkdocs/bin/mike" "$HOME/.local/bin/mike" || true
4752
48-
- name: Build documentation
49-
run: mkdocs build
53+
- name: Configure Git
54+
run: |
55+
git config --global user.name "github-actions[bot]"
56+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
5057
51-
- name: Upload Pages artifact
52-
uses: actions/upload-pages-artifact@v3
53-
with:
54-
path: site/
58+
- name: Deploy dev version
59+
if: github.event_name == 'push' && (github.ref == 'refs/heads/doc' || github.ref == 'refs/heads/main')
60+
run: |
61+
mike deploy --push --update-aliases dev latest
62+
mike set-default --push latest
5563
56-
deploy:
57-
if: github.ref == 'refs/heads/doc' && github.event_name == 'push'
58-
needs: build
59-
runs-on: ubuntu-latest
60-
environment:
61-
name: github-pages
62-
url: ${{ steps.deployment.outputs.page_url }}
63-
steps:
64-
- name: Deploy to GitHub Pages
65-
id: deployment
66-
uses: actions/deploy-pages@v4
64+
- name: Deploy tagged version
65+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
66+
run: |
67+
VERSION=${GITHUB_REF#refs/tags/v}
68+
mike deploy --push --update-aliases $VERSION latest
69+
mike set-default --push latest

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ markdown_extensions:
107107
plugins:
108108
- search
109109
- callouts
110+
- mike
110111

111112
extra:
112113
generator: false
113114
homepage: https://kernelkit.org/
115+
version:
116+
provider: mike

0 commit comments

Comments
 (0)