Files
marqdo/scripts/deploy-public.ps1
T
cflmy 9331af78e2 release(2.8.0): 合入 CHANGELOG/README/发版说明/skills prove 任务;CI 链接指向 doc/releases
- CHANGELOG.md:v2.8.0 条目(中英双语);
- README.md:版本行 2.7.1→2.8.0 + 愿景第 6 条(知识可证明);
- doc/releases/v2.8.0.md:双语发版说明(亮点/用法/已知限制);
- skills/marqdo-dev/index.mq.md:新增 prove 任务(路径/目录模式/
  require_lean/json;参数用 + 行声明升参,check 与 narrative-ratio 通过);
- 设计文档 §12.5 标记已合入;发版链接统一指向 doc/releases/v2.8.0.md。
2026-11-18 10:29:26 +08:00

53 lines
1.6 KiB
PowerShell
Executable File

# Deploy public/ static site to branch gh-pages.
$ErrorActionPreference = "Stop"
$Root = Split-Path $PSScriptRoot -Parent
Set-Location $Root
function Invoke-Git {
param([Parameter(ValueFromRemainingArguments = $true)][string[]]$GitArgs)
$prev = $ErrorActionPreference
$ErrorActionPreference = "Continue"
& git @GitArgs 2>&1 | Out-Null
$code = $LASTEXITCODE
$ErrorActionPreference = $prev
if ($code -ne 0) { throw "git $($GitArgs -join ' ') failed (exit $code)" }
}
if (-not (Test-Path "public\index.html")) {
Write-Host "Building public site..."
cargo build --release -q
& .\target\release\marqdo.exe view output public -o public
}
$staging = Join-Path $Root "dist\gh-pages-publish"
if (Test-Path $staging) {
$prev = $ErrorActionPreference
$ErrorActionPreference = "Continue"
git worktree remove $staging -f 2>&1 | Out-Null
$ErrorActionPreference = $prev
Remove-Item $staging -Recurse -Force -ErrorAction SilentlyContinue
}
Invoke-Git fetch origin gh-pages
Invoke-Git worktree add -B gh-pages $staging origin/gh-pages
Get-ChildItem $staging -Force | Where-Object { $_.Name -ne ".git" } | Remove-Item -Recurse -Force
Copy-Item -Recurse (Join-Path $Root "public\*") $staging -Force
Set-Location $staging
Invoke-Git add -A
$status = git status --porcelain
if ($status) {
Invoke-Git commit -m "Deploy public site for v0.1.2"
Invoke-Git push origin gh-pages
Write-Host "Pushed gh-pages"
} else {
Write-Host "gh-pages unchanged"
}
Set-Location $Root
$prev = $ErrorActionPreference
$ErrorActionPreference = "Continue"
git worktree remove $staging -f 2>&1 | Out-Null
$ErrorActionPreference = $prev