@@ -224,30 +224,34 @@ stages:
224224 - powershell : |
225225 $root = "$(Pipeline.Workspace)/Arduino-Source-Internal/Repository/Public/build/$(cmake_preset)"
226226 $version = "${{ parameters.versionMajor }}.${{ parameters.versionMinor }}.${{ parameters.versionPatch }}"
227- $folderName = "SerialPrograms-$version-Windows-x64 "
227+ $folderName = "SerialPrograms-$version-Windows-$(architecture) "
228228 $name = "SerialPrograms-Windows-$(compiler)-$(architecture)"
229229 $buildType = "${{ parameters.buildType }}"
230230
231- $cacheArtifactsDir = Join-Path $root "cache-artifacts"
232- $artifactSubdir = Join-Path $cacheArtifactsDir $name
231+ $artifactSubdir = Join-Path $root "cache-artifacts" $name
232+ $zipPath = Join-Path $artifactSubdir " $name.zip"
233233 New-Item -ItemType Directory -Force -Path $artifactSubdir | Out-Null
234234
235- $temp = Join-Path $root "temp-archive"
236- $tempFolder = Join-Path $temp $folderName
235+ $tempFolder = Join-Path $root $folderName
237236 New-Item -ItemType Directory -Force -Path $tempFolder | Out-Null
238237 Copy-Item "$root/cache-build/*" $tempFolder -Recurse -Force
239238
240- if ($buildType -eq "PrivateBeta") {
241- Write-Host "=== Encrypting build artifact with password ==="
242- $zipPath = "$artifactSubdir/$name.zip"
243- & "C:/Program Files/7-Zip/7z.exe" a -tzip -mx=9 "-p$env:ARTIFACT_PASSWORD" -mem=AES256 $zipPath "$tempFolder/*"
244- } else {
245- $zipPath = "$artifactSubdir/$name.zip"
246- & "C:/Program Files/7-Zip/7z.exe" a -tzip -mx=9 $zipPath "$tempFolder/*"
239+ Push-Location $root
240+ try {
241+ if ($buildType -eq "PrivateBeta") {
242+ Write-Host "=== Encrypting build artifact with password ==="
243+ & "C:/Program Files/7-Zip/7z.exe" a -tzip -mx=9 "-p$env:ARTIFACT_PASSWORD" -mem=AES256 $zipPath $folderName
244+ } else {
245+ & "C:/Program Files/7-Zip/7z.exe" a -tzip -mx=9 $zipPath $folderName
246+ }
247+ if ($LASTEXITCODE -ne 0) {
248+ throw "7-Zip failed with exit code: $LASTEXITCODE"
249+ }
250+ } finally {
251+ Pop-Location
247252 }
248253
249- Remove-Item $temp -Recurse -Force
250-
254+ Remove-Item $tempFolder -Recurse -Force
251255 Write-Host "=== Created archive with enclosing folder: $folderName ==="
252256 displayName: 'Archive Windows build artifact'
253257 condition: succeeded()
0 commit comments