-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (73 loc) · 2.6 KB
/
deploy-docs.yml
File metadata and controls
93 lines (73 loc) · 2.6 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 to GitHub Pages
on:
push:
tags:
- '*'
permissions:
contents: write
jobs:
deploy-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install MkDocs and Mike
run: |
pip install mkdocs-material mike
- name: Install additional plugins
run: |
pip install -r requirements.txt
- name: Install Playwright for PDF generation
run: |
playwright install --with-deps chromium
- name: build MkDocs
run: |
mkdocs build -f ./mkdocs.yml --clean
- name: Save versioned PDF to repository
run: |
TAG="${GITHUB_REF#refs/tags/}"
mkdir -p exports/pdf
if [ -f "site/pdf/TerraLID_Metadata_Profile.pdf" ]; then
cp "site/pdf/TerraLID_Metadata_Profile.pdf" "exports/pdf/TerraLID_Metadata_Profile_${TAG}.pdf"
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add exports/pdf/
git commit -m "Add PDF export for version ${TAG}" || true
git push origin HEAD:main || true
fi
- name: Determine Version
run: |
TAG="${GITHUB_REF#refs/tags/}"
if [[ "$TAG" == "latest" ]]; then
cd docs/
VERSION=$(mike list --config-file ../mkdocs.yml | grep '\[latest\]' | awk '{print $1}')
cd ..
else
VERSION="$TAG"
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "Mike will deploy version: ${VERSION}"
- name: conigure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "terralid@bergbaumuseum.de"
- name: Deploy Docs
run: |
cd docs
mike deploy --push --config-file ../mkdocs.yml --update-aliases ${{ env.VERSION }} latest
- name: Setup SSH and Auto-Deploy
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -H d-ws164.server.est1816.de >> ~/.ssh/known_hosts
ssh -i ~/.ssh/deploy_key gh-terralid-deployer@d-ws164.server.est1816.de ""
- name: Cleanup
if: always()
run: rm -f ~/.ssh/deploy_key