Skip to content

Commit 61690a9

Browse files
authored
Update build.yml
1 parent 481b96b commit 61690a9

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,38 @@ jobs:
7474
- name: Build with PyInstaller
7575
run: pyinstaller -y yt_audio_workbench.spec
7676
- name: Pack artifact (Windows)
77-
if: startsWith(matrix.os, 'windows')
7877
shell: pwsh
7978
run: |
8079
$ErrorActionPreference = 'Stop'
81-
$zip = "YT-Audio-Workbench-Windows.zip"
82-
Compress-Archive -Path "dist\YT-Audio-Workbench\*" -DestinationPath $zip
83-
echo "ZIP_NAME=$zip" >> $env:GITHUB_ENV
80+
81+
$dist = Join-Path $PWD 'dist'
82+
if (-not (Test-Path $dist)) {
83+
throw "dist/ not found. Did the build step run?"
84+
}
85+
86+
# Prefer a product directory (onedir). Fallback to files (onefile).
87+
$productDir = Get-ChildItem -Path $dist -Directory | Select-Object -First 1
88+
if ($productDir) {
89+
$zip = "$($productDir.Name)-Windows.zip"
90+
Push-Location $productDir.FullName
91+
Compress-Archive -Path * -DestinationPath (Join-Path $dist $zip) -Force
92+
Pop-Location
93+
$zipPath = Join-Path $dist $zip
94+
} else {
95+
$files = Get-ChildItem -Path $dist -File
96+
if (-not $files) {
97+
$found = (Get-ChildItem -Path $dist | Select-Object -ExpandProperty Name) -join ', '
98+
throw "Nothing to pack in dist/. Found entries: $found"
99+
}
100+
$zip = 'YT-Audio-Workbench-Windows.zip'
101+
Compress-Archive -Path ($files | ForEach-Object { $_.FullName }) -DestinationPath (Join-Path $dist $zip) -Force
102+
$zipPath = Join-Path $dist $zip
103+
}
104+
105+
# Expose name/path for the upload step
106+
"ZIP_NAME=$(Split-Path -Leaf $zipPath)" | Out-File -FilePath $env:GITHUB_ENV -Append
107+
"ZIP_PATH=$zipPath" | Out-File -FilePath $env:GITHUB_ENV -Append
108+
84109
- name: Pack artifact (macOS/Linux)
85110
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
86111
run: |

0 commit comments

Comments
 (0)