mirror of
https://git.fightbot.fun/hxuanyu/BingPaper.git
synced 2026-02-15 13:19:33 +08:00
修正脚本:修复 PowerShell 和批处理脚本中的中文乱码问题
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# 切换到项目根目录
|
||||
# 切换到项目根目录
|
||||
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||
if ($ScriptDir) { Set-Location (Join-Path $ScriptDir "..") }
|
||||
|
||||
# 获取版本号
|
||||
# 获取版本号
|
||||
$TagName = $args[0]
|
||||
|
||||
if (-not $TagName) {
|
||||
@@ -10,26 +10,26 @@ if (-not $TagName) {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 确保在 master 分支
|
||||
# 确保在 master 分支
|
||||
$CurrentBranch = git rev-parse --abbrev-ref HEAD
|
||||
if ($CurrentBranch -ne "master") {
|
||||
Write-Host "Error: Must be on master branch to tag. Current branch: $CurrentBranch" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 检查是否有未提交的代码
|
||||
# 检查是否有未提交的代码
|
||||
$Changes = git status --porcelain
|
||||
if ($Changes) {
|
||||
Write-Host "Error: You have uncommitted changes. Please commit or stash them first." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 拉取最新代码
|
||||
# 拉取最新代码
|
||||
Write-Host "Updating master branch..."
|
||||
git pull origin master
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
|
||||
# 检查本地和远端是否一致
|
||||
# 检查本地和远端是否一致
|
||||
$Local = git rev-parse @
|
||||
$Remote = git rev-parse @{u}
|
||||
|
||||
@@ -38,7 +38,7 @@ if ($Local -ne $Remote) {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 创建并推送 tag
|
||||
# 创建并推送 tag
|
||||
Write-Host "Creating tag $TagName..."
|
||||
git tag -f "$TagName"
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
|
||||
Reference in New Issue
Block a user