chore(scripts): 新增一键部署脚本 deploy.ps1
This commit is contained in:
+7
-1
@@ -75,8 +75,14 @@ try {
|
|||||||
if (-not $Message) { throw '-Commit 需要同时提供 -Message "提交说明"' }
|
if (-not $Message) { throw '-Commit 需要同时提供 -Message "提交说明"' }
|
||||||
Write-Host '▶ 本地提交并推送 ...' -ForegroundColor Cyan
|
Write-Host '▶ 本地提交并推送 ...' -ForegroundColor Cyan
|
||||||
& git add -A
|
& git add -A
|
||||||
|
& git diff --cached --quiet
|
||||||
|
if ($LASTEXITCODE -eq 0) {
|
||||||
|
Write-Host ' 没有待提交改动,跳过 commit' -ForegroundColor DarkGray
|
||||||
|
}
|
||||||
|
else {
|
||||||
& git commit -m $Message
|
& git commit -m $Message
|
||||||
if ($LASTEXITCODE -ne 0) { throw 'git commit 失败(可能没有改动)' }
|
if ($LASTEXITCODE -ne 0) { throw 'git commit 失败' }
|
||||||
|
}
|
||||||
& git push origin main
|
& git push origin main
|
||||||
if ($LASTEXITCODE -ne 0) { throw 'git push 失败' }
|
if ($LASTEXITCODE -ne 0) { throw 'git push 失败' }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user