Files
blog/deploy.ps1
T
2026-01-22 21:39:19 +08:00

29 lines
937 B
PowerShell

# 设置控制台编码为 UTF-8,防止中文乱码
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
Write-Host "🔍 正在进行友链健康检查..." -ForegroundColor Cyan
# 运行 Node.js 检查脚本
node scripts/check_links.js
# 检查脚本退出代码
if ($LASTEXITCODE -ne 0) {
Write-Host "⚠️ 友链检查发现问题或执行失败。" -ForegroundColor Yellow
$response = Read-Host "是否继续执行 Hugo 打包?(Y/N)"
if ($response -ne 'Y' -and $response -ne 'y') {
Write-Host "❌ 已取消打包。" -ForegroundColor Red
exit
}
} else {
Write-Host "✅ 友链检查通过。" -ForegroundColor Green
}
Write-Host "🚀 开始执行 Hugo 打包..." -ForegroundColor Cyan
hugo --minify
if ($LASTEXITCODE -eq 0) {
Write-Host "🎉 打包成功!" -ForegroundColor Green
} else {
Write-Host "❌ 打包失败,请检查错误日志。" -ForegroundColor Red
}