forked from longhorn/longhorn-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (57 loc) · 1.92 KB
/
publish.yaml
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
name: Publish Docs
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch gh-pages branch
run: |
git fetch --depth=1 origin gh-pages
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install pdoc3
run: |
pip install pdoc3
- name: Install test requirements
run: |
pip install -r manager/integration/tests/requirements.txt
- name: Run pdoc3
run: |
pdoc --html -o . .
mv tests/ ../../../docs/content/integration
working-directory: ./manager/integration/tests/
- name: Install Hugo
run: |
curl -Lo hugo.tar.gz https://github.com/gohugoio/hugo/releases/download/v0.92.2/hugo_0.92.2_Linux-64bit.tar.gz
tar -xf hugo.tar.gz -C /usr/local/bin/ hugo
- name: Run Hugo
run: |
hugo
working-directory: ./docs/
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Deploy new test docs
run: |
# Adapted from https://github.com/helm/chart-releaser-action/blob/master/cr.sh
gh_pages_worktree=$(mktemp -d)
git worktree add "$gh_pages_worktree" gh-pages
pushd "$gh_pages_worktree" > /dev/null
git rm -r --ignore-unmatch .
popd > /dev/null
mv docs/public/* "$gh_pages_worktree"
pushd "$gh_pages_worktree" > /dev/null
git add .
# Only commit files if changes are detected
git diff-index --quiet HEAD || git commit --message="Update testing docs" --signoff
git push origin gh-pages
popd > /dev/null
git worktree remove "$gh_pages_worktree"