Skip to content

Commit bdf8f82

Browse files
authored
Refactor comments and improve zip verification process
1 parent 2851e82 commit bdf8f82

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

.github/workflows/build.yml

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Build (${{ matrix.config }})
3636
run: cmake --build ${{ github.workspace }}\build --config ${{ matrix.config }} -- /m
3737

38-
# CI artifacts (for convenience): DLLs + PDBs if present (no .lib, no .exe)
38+
# CI artifacts (convenience): DLLs + PDBs if present (no .lib, no .exe)
3939
- name: Upload CI artifacts (${{ matrix.config }})
4040
uses: actions/upload-artifact@v4
4141
with:
@@ -47,7 +47,7 @@ jobs:
4747

4848
# ----- Release publishing (only when a GitHub Release is published) -----
4949

50-
# Remove any existing assets with same names (prevents stale zips)
50+
# Remove any existing assets with same names to avoid stale uploads
5151
- name: Remove existing assets
5252
if: github.event_name == 'release' && github.event.action == 'published'
5353
uses: actions/github-script@v7
@@ -68,7 +68,7 @@ jobs:
6868
}
6969
}
7070
71-
# Stage and zip EXACT files (DLLs only; symbols only) so .lib can never slip in
71+
# Stage and zip EXACT files; print zip contents; fail if any .lib is present
7272
- name: Package (${{ matrix.config }})
7373
if: github.event_name == 'release' && github.event.action == 'published'
7474
shell: pwsh
@@ -101,18 +101,44 @@ jobs:
101101
if (Test-Path $zipBin) { Remove-Item $zipBin -Force }
102102
if (Test-Path $zipSym) { Remove-Item $zipSym -Force }
103103
104-
if (Test-Path "$stage\binaries") {
105-
$binFiles = Get-ChildItem "$stage\binaries" -File
106-
if ($binFiles) { Compress-Archive -Path ($binFiles | Select-Object -Expand FullName) -DestinationPath $zipBin -Force }
104+
$binFiles = Get-ChildItem "$stage\binaries" -File | Select-Object -Expand FullName
105+
if ($binFiles) { Compress-Archive -Path $binFiles -DestinationPath $zipBin -Force }
106+
107+
if ($cfg -eq "Debug") {
108+
$symFiles = Get-ChildItem "$stage\symbols" -File | Select-Object -Expand FullName
109+
if ($symFiles) { Compress-Archive -Path $symFiles -DestinationPath $zipSym -Force }
107110
}
108111
109-
if ($cfg -eq "Debug" -and (Test-Path "$stage\symbols")) {
110-
$symFiles = Get-ChildItem "$stage\symbols" -File
111-
if ($symFiles) { Compress-Archive -Path ($symFiles | Select-Object -Expand FullName) -DestinationPath $zipSym -Force }
112+
# --- Print and verify zip entries (no .lib allowed) ---
113+
Add-Type -AssemblyName System.IO.Compression.FileSystem
114+
115+
function Show-And-VerifyZip([string]$zipPath, [string]$label) {
116+
if (Test-Path $zipPath) {
117+
$z = [System.IO.Compression.ZipFile]::OpenRead($zipPath)
118+
try {
119+
Write-Host "ZIP ($label): $zipPath"
120+
foreach ($e in $z.Entries) {
121+
Write-Host " - $($e.FullName)"
122+
if ($e.FullName.ToLower().EndsWith('.lib')) {
123+
throw "Found .lib in $zipPath: $($e.FullName)"
124+
}
125+
}
126+
} finally { $z.Dispose() }
127+
} else {
128+
Write-Host "ZIP ($label): (not created)"
129+
}
112130
}
113131
132+
Show-And-VerifyZip $zipBin "binaries"
133+
if ($cfg -eq "Debug") { Show-And-VerifyZip $zipSym "symbols" }
134+
135+
# Also show what we staged (human-friendly)
114136
Write-Host "Binaries staged:"; Get-ChildItem "$stage\binaries" -File | ForEach-Object { Write-Host " $($_.Name)" }
115-
Write-Host "Symbols staged:"; if ($cfg -eq "Debug") { Get-ChildItem "$stage\symbols" -File | ForEach-Object { Write-Host " $($_.Name)" } } else { Write-Host " (none for Release)" }
137+
if ($cfg -eq "Debug") {
138+
Write-Host "Symbols staged:"; Get-ChildItem "$stage\symbols" -File | ForEach-Object { Write-Host " $($_.Name)" }
139+
} else {
140+
Write-Host "Symbols staged: (none for Release)"
141+
}
116142
117143
# Upload assets to the GitHub Release
118144
- name: Upload Debug assets

0 commit comments

Comments
 (0)