forked from calagopus/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtag-release.sh
More file actions
executable file
·41 lines (32 loc) · 1.02 KB
/
tag-release.sh
File metadata and controls
executable file
·41 lines (32 loc) · 1.02 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
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <version>"
echo "Example stable: $0 1.0.0"
echo "Example pre-release: $0 1.0.0-pre.1"
exit 1
fi
VERSION=$1
REGEX="^([0-9]+\.[0-9]+\.[0-9]+|[0-9]+\.[0-9]+\.[0-9]+-pre\.[0-9]+)$"
if [[ ! $VERSION =~ $REGEX ]]; then
echo "Error: Invalid version format '$VERSION'."
echo "Allowed formats are strict SemVer:"
echo " - Stable: x.x.x (e.g., 1.0.0)"
echo " - Pre-release: x.x.x-pre.x (e.g., 1.0.0-pre.1)"
exit 1
fi
TAG_NAME="release-$VERSION"
echo "Applying tag: $TAG_NAME..."
if git tag "$TAG_NAME"; then
echo "Tag created successfully."
else
echo "Error: Failed to create tag '$TAG_NAME'. Does it already exist locally?"
exit 1
fi
echo "Pushing $TAG_NAME to origin..."
if git push origin "$TAG_NAME"; then
echo "Success! Pushed $TAG_NAME to origin."
echo "Your GitHub Actions release pipeline should trigger shortly."
else
echo "Error: Failed to push tag. Check your network or git permissions."
exit 1
fi