-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76424b0
commit 067d249
Showing
4 changed files
with
95 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,40 @@ | ||
$version = $( git describe --tags --abbrev=0 ) | ||
$splitter = $version.split(".") | ||
$build = [int]($splitter[2]) + 1 | ||
$newVersion = $splitter[0] + "." + $splitter[1] + "." + $build | ||
|
||
write-host $newVersion | ||
git tag -a $newVersion -m "new release" | ||
git push origin $newVersion | ||
param( | ||
[Parameter(Mandatory = $false)] | ||
[ValidateNotNullOrEmpty()] | ||
[string]$message = "new release" | ||
) | ||
|
||
$versionPattern = '^\d+\.\d+\.\d+$' | ||
$version = $null | ||
|
||
try | ||
{ | ||
$version = $( git describe --tags --abbrev=0 ) | ||
if ($version -notmatch $versionPattern) | ||
{ | ||
Write-Error "Invalid version format. Expected: x.y.z" | ||
exit 1 | ||
} | ||
|
||
$splitter = $version.split(".") | ||
$build = [int]($splitter[2]) + 1 | ||
[string]$newVersion = $splitter[0] + "." + $splitter[1] + "." + $build.ToString() | ||
|
||
if ([version]$newVersion -le [version]$version) | ||
{ | ||
Write-Error "New version must be greater than current version" | ||
exit 1 | ||
} | ||
|
||
Write-Host "Current version: $version" | ||
Write-Host "New version: $newVersion" | ||
Write-Host "Creating new tag..." | ||
|
||
git tag -a $newVersion -m "$message" | ||
git push origin $newVersion | ||
} | ||
catch | ||
{ | ||
Write-Error "An error occurred: $_" | ||
exit 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
# Parameters | ||
message="${1:-new release}" | ||
|
||
# Version pattern | ||
versionPattern='^[0-9]+\.[0-9]+\.[0-9]+$' | ||
version='' | ||
|
||
# Get the current version | ||
version=$(git describe --tags --abbrev=0 2>/dev/null) | ||
if [[ ! $version =~ $versionPattern ]]; then | ||
echo "Invalid version format. Expected: x.y.z" | ||
exit 1 | ||
fi | ||
|
||
# Split the version and increment the build number | ||
IFS='.' read -r major minor build <<< "$version" | ||
newBuild=$((build + 1)) | ||
newVersion="$major.$minor.$newBuild" | ||
|
||
if [[ ! "$newVersion" > "$version" ]]; then | ||
echo "New version must be greater than current version" | ||
exit 1 | ||
fi | ||
|
||
# Output the current and new version | ||
echo "Current version: $version" | ||
echo "New version: $newVersion" | ||
echo "Creating new tag..." | ||
|
||
# Create a new tag and push it | ||
git tag -a "$newVersion" -m "$message" | ||
git push origin "$newVersion" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters