generated from y-scope/public-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (70 loc) · 2.06 KB
/
docs.yml
File metadata and controls
82 lines (70 loc) · 2.06 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: "docs"
on:
push:
branches: ["beta", "main"]
paths:
- "docs/**"
- "src/log_surgeon/**"
- "mkdocs.yml"
- ".github/workflows/docs.yml"
pull_request:
paths:
- "docs/**"
- "src/log_surgeon/**"
- "mkdocs.yml"
- ".github/workflows/docs.yml"
concurrency:
group: "${{github.workflow}}-${{github.ref}}"
cancel-in-progress: true
jobs:
build:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.12"
- name: "Install dependencies"
run: |
pip install mkdocs mkdocs-material "mkdocstrings[python]"
pip install log-surgeon-ffi
- name: "Build docs"
run: "mkdocs build"
deploy:
if: github.event_name == 'push'
runs-on: "ubuntu-latest"
permissions:
contents: "write"
steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.12"
- name: "Install dependencies"
run: |
pip install mkdocs mkdocs-material "mkdocstrings[python]" mike
pip install log-surgeon-ffi
- name: "Configure git"
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: "Fetch gh-pages branch"
run: |
git fetch origin gh-pages --depth=1
- name: "Deploy versioned docs"
run: |
VERSION="${GITHUB_REF_NAME}"
if [[ "$VERSION" == "main" ]]; then
mike deploy --push --update-aliases "$VERSION" latest
mike set-default --push latest
else
mike deploy --push "$VERSION"
# Set beta as default only if no default exists yet
if ! grep -q '"default": true' <(mike list --json 2>/dev/null); then
mike set-default --push "$VERSION"
fi
fi