fix: handle Vercel CLI stderr as ErrorRecord in release script
- Set ErrorActionPreference to Continue before vercel commands to prevent PowerShell from treating Vercel CLI stderr output (version banner) as a terminating error and jumping to the catch block prematurely - Strip ANSI cursor-movement escape codes from output before regex matching the Production URL (--no-color does not remove cursor movement sequences) - Convert all 2>&1 output to strings via .ToString() before processing Made-with: Cursor
This commit is contained in:
parent
c8ffe2626f
commit
cb71ab91de
|
|
@ -186,22 +186,31 @@ Write-Host "[5/5] Deploying to Vercel..." -ForegroundColor Yellow
|
||||||
$vercelDir = Join-Path $PSScriptRoot "web\download"
|
$vercelDir = Join-Path $PSScriptRoot "web\download"
|
||||||
Push-Location $vercelDir
|
Push-Location $vercelDir
|
||||||
try {
|
try {
|
||||||
$deployLines = vercel --prod --yes --no-color 2>&1
|
# Vercel CLI が stderr に "Vercel CLI x.x.x" を書くため、ErrorRecord を文字列に変換して収集する
|
||||||
|
$prevEap = $ErrorActionPreference
|
||||||
|
$ErrorActionPreference = 'Continue'
|
||||||
|
$deployLines = vercel --prod --yes --no-color 2>&1 | ForEach-Object { $_.ToString() }
|
||||||
|
$ErrorActionPreference = $prevEap
|
||||||
|
|
||||||
$deployLines | ForEach-Object { Write-Host " $_" }
|
$deployLines | ForEach-Object { Write-Host " $_" }
|
||||||
|
|
||||||
# Extract deployment URL (format: "Production: https://...vercel.app [Ns]")
|
# ANSI エスケープコード(カーソル移動等)を除去してから Production: 行を抽出
|
||||||
$prodLine = $deployLines | Where-Object { $_ -match "(?i)Production:\s+https://" } | Select-Object -First 1
|
$cleanLines = $deployLines | ForEach-Object { $_ -replace '\x1B\[[0-9;]*[A-Za-z]', '' -replace '\x1B\[[\?][0-9;]*[A-Za-z]', '' }
|
||||||
|
$prodLine = $cleanLines | Where-Object { $_ -match "(?i)Production:\s+https://" } | Select-Object -First 1
|
||||||
$prodUrl = $null
|
$prodUrl = $null
|
||||||
if ($prodLine -match 'https://\S+') {
|
if ($prodLine -match 'https://\S+') {
|
||||||
$prodUrl = $Matches[0] -replace '\s.*$', ''
|
$prodUrl = ($Matches[0] -replace '\s.*$', '').Trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($prodUrl) {
|
if ($prodUrl) {
|
||||||
Write-Host " Setting alias ponshu-room.vercel.app -> $prodUrl ..." -ForegroundColor Gray
|
Write-Host " Setting alias ponshu-room.vercel.app -> $prodUrl ..." -ForegroundColor Gray
|
||||||
vercel alias set $prodUrl ponshu-room.vercel.app --yes 2>&1 | ForEach-Object { Write-Host " $_" }
|
$prevEap2 = $ErrorActionPreference
|
||||||
|
$ErrorActionPreference = 'Continue'
|
||||||
|
vercel alias set $prodUrl ponshu-room.vercel.app 2>&1 | ForEach-Object { Write-Host " $_" }
|
||||||
|
$ErrorActionPreference = $prevEap2
|
||||||
Write-Host " OK: Alias set" -ForegroundColor Green
|
Write-Host " OK: Alias set" -ForegroundColor Green
|
||||||
} else {
|
} else {
|
||||||
Write-Host " [WARN] Could not extract deployment URL from vercel output. Run manually:" -ForegroundColor Yellow
|
Write-Host " [WARN] Could not extract deployment URL. Run manually:" -ForegroundColor Yellow
|
||||||
Write-Host " vercel alias set <deployment-url> ponshu-room.vercel.app" -ForegroundColor Yellow
|
Write-Host " vercel alias set <deployment-url> ponshu-room.vercel.app" -ForegroundColor Yellow
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
{
|
{
|
||||||
"date": "2026-04-11",
|
"date": "2026-04-12",
|
||||||
"name": "Ponshu Room 1.0.30 (2026-04-11)",
|
"name": "Ponshu Room 1.0.31 (2026-04-12)",
|
||||||
"version": "v1.0.30",
|
"version": "v1.0.31",
|
||||||
"apks": {
|
"apks": {
|
||||||
"eiji": {
|
"eiji": {
|
||||||
"lite": {
|
"lite": {
|
||||||
"url": "https://posimai-lab.tail72e846.ts.net/mai/ponshu-room-lite/releases/download/v1.0.30/ponshu_room_consumer_eiji.apk",
|
"url": "https://posimai-lab.tail72e846.ts.net/mai/ponshu-room-lite/releases/download/v1.0.31/ponshu_room_consumer_eiji.apk",
|
||||||
"size_mb": 89.1,
|
"size_mb": 89.1,
|
||||||
"filename": "ponshu_room_consumer_eiji.apk"
|
"filename": "ponshu_room_consumer_eiji.apk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"maita": {
|
"maita": {
|
||||||
"lite": {
|
"lite": {
|
||||||
"url": "https://posimai-lab.tail72e846.ts.net/mai/ponshu-room-lite/releases/download/v1.0.30/ponshu_room_consumer_maita.apk",
|
"url": "https://posimai-lab.tail72e846.ts.net/mai/ponshu-room-lite/releases/download/v1.0.31/ponshu_room_consumer_maita.apk",
|
||||||
"size_mb": 89.1,
|
"size_mb": 89.1,
|
||||||
"filename": "ponshu_room_consumer_maita.apk"
|
"filename": "ponshu_room_consumer_maita.apk"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue