forked from kube-burner/kube-burner
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (40 loc) · 1.39 KB
/
docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Deploy docs
on:
workflow_call:
jobs:
deploy-docs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Setup doc deploy
run: |
git config --global user.name Docs deploy
git config --global user.email [email protected]
- name: Install dependencies
run: pip install mkdocs-material mkdocs-include-markdown-plugin mike
- name: Deploy docs
run: mike deploy --push -m "Update docs to version ${{ github.ref_name }}" --update-aliases ${{ github.ref_name }} latest
- name: Delete docs for older tags
run: |
echo "Keeping documentation for latest tags"
all_tags=$(git tag --sort=-v:refname)
tags_to_keep=$(echo "$all_tags" | head -n 3)
for tag in $all_tags; do
if [[ $tags_to_keep != *"$tag"* ]]; then
if mike list | grep -q "$tag"; then
echo "Deleting documentation for tag: $tag"
mike delete "$tag"
else
echo "Documentation for tag $tag not found. Skipping deletion."
fi
fi
done
- name: Set latest as default doc branch
run: mike set-default --push latest