This repository was archived by the owner on Oct 25, 2026. It is now read-only.
Repository navigation
83 lines (71 loc) · 2.59 KB
/
Copy pathdocs-deploy.yml
File metadata and controls
83 lines (71 loc) · 2.59 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
name: Deploy Documentation
on:
push:
branches:
- main
tags:
- "v*.*.*"
workflow_dispatch:
permissions:
contents: write
concurrency:
group: viiper-gh-pages
cancel-in-progress: false
jobs:
deploy-docs:
name: Deploy Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.x
- name: Install dependencies
run: pip install -r requirements.txt
- name: Inject version into install scripts
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
VERSION=${TAG_NAME#v}
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
echo "Injecting version: $TAG_NAME into install scripts"
sed -i "s/VIIPER_VERSION=\"dev-snapshot\"/VIIPER_VERSION=\"$TAG_NAME\"/" scripts/install.sh
sed -i "s/\\\$viiperVersion = \"dev-snapshot\"/\\\$viiperVersion = \"$TAG_NAME\"/" scripts/install.ps1
fi
- name: Copy installation scripts to docs
run: |
cp scripts/install.sh docs/install.sh
cp scripts/install.ps1 docs/install.ps1
- name: Generate changelog
run: |
chmod +x .github/scripts/generate-changelog.sh
mkdir -p docs/changelog
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "Generating changelog for tagged version: $TAG_NAME"
.github/scripts/generate-changelog.sh docs/changelog/index.md "$TAG_NAME"
else
echo "Generating changelog for main (unreleased)"
.github/scripts/generate-changelog.sh docs/changelog/index.md
fi
if ! head -n1 docs/changelog/index.md | grep -q "^#"; then
{ echo "# Changelog"; echo; cat docs/changelog/index.md; } > docs/changelog/index.md.tmp && mv docs/changelog/index.md.tmp docs/changelog/index.md
fi
head -n 20 docs/changelog/index.md
- name: Build documentation
run: zensical build --strict
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
publish_branch: gh-pages
force_orphan: false