-
-
Notifications
You must be signed in to change notification settings - Fork 10
123 lines (107 loc) · 4.82 KB
/
Copy pathdocs-deploy.yml
File metadata and controls
123 lines (107 loc) · 4.82 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Deploy Documentation
on:
push:
branches:
- main
tags:
- "v*.*.*"
permissions:
contents: write
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 mkdocs-material mike
- 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 for main
if: github.ref == 'refs/heads/main'
run: |
chmod +x .github/scripts/generate-changelog.sh
.github/scripts/generate-changelog.sh docs/changelog/main.md
# Build changelog index page with links to all versions
mkdir -p docs/changelog
{
echo "# Changelog"
echo
echo "## Unreleased"
echo
echo "- [Development Version (main)](./main/)"
echo
echo "## Released Versions"
echo
} > docs/changelog/index.md
# List all version tags and link to their changelog pages
git tag -l 'v*.*.*' --sort=-version:refname | while read tag; do
VERSION=${tag#v}
echo "- [Version $VERSION](../../$VERSION/changelog/$VERSION/)" >> docs/changelog/index.md
done
- name: Deploy main version (main)
if: github.ref == 'refs/heads/main'
run: |
mike deploy --push --update-aliases main latest
- name: Generate changelog for tagged version
if: startsWith(github.ref, 'refs/tags/')
run: |
chmod +x .github/scripts/generate-changelog.sh
TAG_NAME=${GITHUB_REF#refs/tags/}
VERSION=${TAG_NAME#v}
.github/scripts/generate-changelog.sh "docs/changelog/$VERSION.md" "$TAG_NAME"
# Build changelog index page with links to all versions
mkdir -p docs/changelog
{
echo "# Changelog"
echo
echo "## Unreleased"
echo
echo "- [Development Version (main)](../../latest/changelog/main/)"
echo
echo "## Released Versions"
echo
} > docs/changelog/index.md
# List all version tags and link to their changelog pages
git tag -l 'v*.*.*' --sort=-version:refname | while read tag; do
VER=${tag#v}
echo "- [Version $VER](../../$VER/changelog/$VER/)" >> docs/changelog/index.md
done
- name: Deploy tagged version
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
VERSION=${TAG_NAME#v}
# Check if this is a pre-release (contains -, alpha, beta, rc)
if [[ "$VERSION" =~ - ]]; then
echo "Deploying pre-release version: $VERSION"
mike deploy --push "$VERSION"
else
echo "Deploying stable version: $VERSION"
mike deploy --push --update-aliases "$VERSION" stable
mike set-default --push stable
fi