mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-09-19 22:46:01 +00:00
ci: release tagging script
This commit is contained in:
35
tag.ps1
Normal file
35
tag.ps1
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# Release tagging script for Windows (PowerShell)
|
||||||
|
|
||||||
|
# Usage:
|
||||||
|
# ./tag.ps1 <version>
|
||||||
|
|
||||||
|
if (!(Get-Command git -ErrorAction SilentlyContinue)) {
|
||||||
|
Write-Host "Error: git is not installed." -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if (!(git rev-parse --is-inside-work-tree 2>$null)) {
|
||||||
|
Write-Host "Error: not in a git repository." -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($args.Length -eq 0) {
|
||||||
|
Write-Host "Error: no version argument given." -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if ($args[0] -notmatch "^[v]?[0-9]+\.[0-9]+\.[0-9]+$") {
|
||||||
|
Write-Host "Error: invalid version argument." -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
if ($args[0] -notmatch "^[v]") {
|
||||||
|
$args[0] = "v" + $args[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
$version = $args[0]
|
||||||
|
$tags = @($version, "app/$version", "core/$version")
|
||||||
|
|
||||||
|
foreach ($tag in $tags) {
|
||||||
|
Write-Host "Tagging $tag..."
|
||||||
|
git tag $tag
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Done." -ForegroundColor Green
|
40
tag.sh
Normal file
40
tag.sh
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Release tagging script for Linux
|
||||||
|
|
||||||
|
# Usage:
|
||||||
|
# ./tag.sh <version>
|
||||||
|
|
||||||
|
if ! [ -x "$(command -v git)" ]; then
|
||||||
|
echo 'Error: git is not installed.' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||||
|
echo 'Error: not in a git repository.' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$#" -eq 0 ]; then
|
||||||
|
echo "Error: no version argument given." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! [[ $1 =~ ^[v]?[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
|
echo "Error: invalid version argument." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! [[ $1 =~ ^[v] ]]; then
|
||||||
|
version="v$1"
|
||||||
|
else
|
||||||
|
version="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
tags=($version "app/$version" "core/$version")
|
||||||
|
|
||||||
|
for tag in "${tags[@]}"; do
|
||||||
|
echo "Tagging $tag..."
|
||||||
|
git tag "$tag"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Done."
|
Reference in New Issue
Block a user