fix(发布): 常规部署跳过下载产物

This commit is contained in:
WuYongJie 2026-07-10 14:07:21 +08:00
parent 879d74f668
commit 5ce86b0f5c

View File

@ -7,6 +7,7 @@ param(
[switch]$SkipDeploy,
[switch]$SkipBackup,
[switch]$AllowDirty,
[switch]$IncludeDownloadArtifacts,
[switch]$DryRun
)
@ -26,7 +27,6 @@ $expectedRemoteArchive = "/tmp/equipment-management-release.tar.gz"
$releasePaths = @(
"backend",
"frontend",
"downloads",
"scripts/backup-equipment.sh",
".env.example",
"AGENTS.md",
@ -37,6 +37,10 @@ $releasePaths = @(
"docker-compose.yml"
)
if ($IncludeDownloadArtifacts) {
$releasePaths += "downloads"
}
function Get-CommandPath([string]$name) {
$cmd = Get-Command $name -ErrorAction SilentlyContinue
if (-not $cmd) {
@ -175,7 +179,11 @@ if ($files.Count -eq 0) {
throw "No files matched the release allowlist."
}
$artifactFiles = @(Get-DownloadArtifactFiles $projectRoot)
$artifactFiles = if ($IncludeDownloadArtifacts) {
@(Get-DownloadArtifactFiles $projectRoot)
} else {
@()
}
$files = @(($files + $artifactFiles) | Sort-Object -Unique)
$missingFiles = @($files | Where-Object { -not (Test-Path -LiteralPath $_ -PathType Leaf) })
@ -197,6 +205,7 @@ Write-Host " Git commit: $commitId"
Write-Host " File count: $($files.Count)"
Write-Host " Source size: $([math]::Round($totalBytes / 1MB, 2)) MiB"
Write-Host " Download artifacts: $($artifactFiles.Count)"
Write-Host " Include download artifacts: $([bool]$IncludeDownloadArtifacts)"
Write-Host " Allowlist: $($releasePaths -join ', ')"
if ($DryRun) {