Repository navigation
93 lines (80 loc) · 2.41 KB
/
Copy pathdeploy.yml
File metadata and controls
93 lines (80 loc) · 2.41 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
83
84
85
86
87
88
89
90
91
92
93
name: Deploy Docs
on:
push:
branches:
- master
workflow_dispatch:
concurrency:
group: docs-kvm-build-deploy
cancel-in-progress: false
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
langs_json: ${{ steps.langs.outputs.json }}
steps:
- name: Define document languages
id: langs
run: |
echo 'json=["en","de","ja"]' >> "$GITHUB_OUTPUT"
build:
runs-on: ubuntu-latest
needs: prepare
strategy:
fail-fast: false
matrix:
lang: ${{ fromJSON(needs.prepare.outputs.langs_json) }}
steps:
- name: Checkout source repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10.4"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build ${{ matrix.lang }} MkDocs site
working-directory: docs/${{ matrix.lang }}
run: mkdocs build --site-dir ../../site/${{ matrix.lang }}
- name: Upload ${{ matrix.lang }} artifact
uses: actions/upload-artifact@v4
with:
name: site-${{ matrix.lang }}
path: site/${{ matrix.lang }}
if-no-files-found: error
deploy:
runs-on: ubuntu-latest
needs:
- prepare
- build
steps:
- name: Download built site artifacts
uses: actions/download-artifact@v4
with:
pattern: site-*
path: site
- name: Checkout target repo (docs-build)
uses: actions/checkout@v4
with:
repository: gl-inet/docs-build
ssh-key: ${{ secrets.DEPLOY_KEY }}
path: docs-build
clean: true
fetch-depth: 0
- name: Deploy built docs to docs-build
run: |
for lang in ${{ join(fromJSON(needs.prepare.outputs.langs_json), ' ') }}; do
rm -rf docs-build/kvm/$lang
mkdir -p docs-build/kvm/$lang
cp -r site/site-$lang/. docs-build/kvm/$lang/
done
- name: Commit and push to docs-build
working-directory: docs-build
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A kvm/
git diff --cached --quiet || git commit -m "docs(kvm): update from gl-inet/docs-kvm@${{ github.sha }}"
git push