-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (63 loc) · 1.85 KB
/
Copy pathdocs.yml
File metadata and controls
68 lines (63 loc) · 1.85 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
name: Docs
run-name: ${{ github.actor }} is running Docs
on:
workflow_dispatch:
push:
branches:
- master
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: write
env:
MKDOCS_SITE_URL: "https://serpro69.github.io/ktchn8s/"
jobs:
changes:
runs-on: ubuntu-latest
outputs:
docs: ${{ steps.filter.outputs.docs }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
docs:
- '.github/workflows/docs.yml'
- 'docs/**'
- 'mkdocs.yml'
- 'LICENSE.md'
- 'README.md'
deploy:
needs: changes
if: ${{ startsWith(github.ref, 'refs/tags/v') || needs.changes.outputs.docs == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure git credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install -r requirements.txt
- run: |-
if [[ ! "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
mike deploy --push latest
else
# use <major.minor> as version for documentation
version_regex='[^0-9]*\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)'
version=$(echo "${{ github.ref_name }}" | sed -e "s#${version_regex}#\1.\2#")
mike deploy --push "$version"
fi