Files

35 lines
1.2 KiB
PowerShell
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 一鍵:commit 未提交變更 + push 到 karylab_agents forkremote: karylab
# 用法:powershell -ExecutionPolicy Bypass -File scripts\push_current.ps1
$ErrorActionPreference = 'Stop'
Set-Location (Join-Path $PSScriptRoot '..')
$git = Get-Command git -ErrorAction SilentlyContinue
if (-not $git) {
$runtimeGit = 'C:\Users\ckliu\.cache\codex-runtimes\codex-primary-runtime\dependencies\native\git\cmd\git.exe'
if (Test-Path $runtimeGit) { $gitCmd = $runtimeGit } else { throw '找不到 git' }
} else { $gitCmd = $git.Source }
Write-Host '== 目前狀態 =='
& $gitCmd status --short
Write-Host ''
Write-Host '== 若有變更則提交 =='
$dirty = (& $gitCmd status --porcelain).Trim() -ne ''
if ($dirty) {
& $gitCmd add -A
if ($LASTEXITCODE -ne 0) { throw 'git add 失敗' }
& $gitCmd commit -m "Fix playerJoined roomId + add /api proxy to dist server"
if ($LASTEXITCODE -ne 0) { throw 'git commit 失敗' }
} else {
Write-Host '(無未提交變更)'
}
Write-Host ''
Write-Host '== Push 到 forkkarylab -> karylab_agents=='
& $gitCmd push karylab feat/web-game
if ($LASTEXITCODE -ne 0) { throw 'git push 失敗' }
Write-Host ''
Write-Host '== 完成 =='
& $gitCmd log --oneline -3