-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from Zhaopudark/dev
Prepare for publish
- Loading branch information
Showing
1 changed file
with
24 additions
and
22 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,24 +1,26 @@ | ||
$currentBranch = git rev-parse --abbrev-ref HEAD | ||
if ($currentBranch -eq "main") { | ||
$version = . "${PSScriptRoot}/check_release_version.ps1" | ||
$tagName = "v${version}" | ||
# 检测标签是否存在 | ||
if (git show-ref "refs/tags/$tagName") { | ||
Write-Error "Tag '$tagName' already exists." | ||
} else { | ||
# 标签不存在 | ||
Write-Output "Tag '$tagName' does not exist." | ||
Write-Output "Creating tag '$tagName'." | ||
git tag -a $tagName -m "Release $tagName" | ||
} | ||
|
||
$version = . "${PSScriptRoot}/check_release_version.ps1" | ||
$tagName = "v${version}" | ||
|
||
# 检测标签是否存在 | ||
if (git show-ref "refs/tags/$tagName") { | ||
Write-Error "Tag '$tagName' already exists." | ||
} else { | ||
# 标签不存在 | ||
Write-Output "Tag '$tagName' does not exist." | ||
Write-Output "Creating tag '$tagName'." | ||
git tag -a $tagName -m "Release $tagName" | ||
} | ||
|
||
# 检测远程标签是否存在 | ||
if (git ls-remote --tags origin | Where-Object { $_ -match "refs/tags/$tagName" }) { | ||
Write-Error "Remote tag '$tagName' already exists." | ||
# 检测远程标签是否存在 | ||
if (git ls-remote --tags origin | Where-Object { $_ -match "refs/tags/$tagName" }) { | ||
Write-Error "Remote tag '$tagName' already exists." | ||
} else { | ||
# 远程标签不存在 | ||
Write-Output "Remote tag '$tagName' does not exist." | ||
Write-Output "Pushing tag '$tagName' to remote." | ||
git push origin $tagName | ||
} | ||
} else { | ||
# 远程标签不存在 | ||
Write-Output "Remote tag '$tagName' does not exist." | ||
Write-Output "Pushing tag '$tagName' to remote." | ||
git push origin $tagName | ||
} | ||
|
||
Write-Host "Not on main branch. Current branch: $currentBranch" | ||
} |