-
Notifications
You must be signed in to change notification settings - Fork 57
67 lines (65 loc) · 1.62 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: docs
on:
push:
branches:
- 'main'
- 'v*'
tags:
- 'v*'
paths:
- '.github/workflows/docs.yml'
- 'docs/**'
- 'mkdocs.yml'
pull_request:
branches:
- 'main'
- 'v*'
paths:
- '.github/workflows/docs.yml'
- 'docs/**'
- 'mkdocs.yml'
jobs:
publish:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Prepare
id: prepare
run: |
VERSION=edge
RELEASE=false
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
RELEASE=true
fi
echo ::set-output name=release::${RELEASE}
-
name: Build mkdocs Docker image
run: |
docker build -t mkdocs -f ./docs/Dockerfile ./
-
name: Build docs
run: |
docker run --rm -v "$(pwd):/docs" mkdocs build --strict
sudo chown -R $(id -u):$(id -g) ./site
-
name: Check GitHub Pages status
uses: crazy-max/ghaction-github-status@v1
with:
pages_threshold: major_outage
-
name: Deploy
if: success() && github.event_name != 'pull_request' && (endsWith(github.ref, 'main') || steps.prepare.outputs.release == 'true')
uses: crazy-max/[email protected]
with:
target_branch: gh-pages
build_dir: site
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}