@@ -28,7 +28,23 @@ else {
2828
2929Copy-Item $ExeSource - Destination $ArtifactsDir
3030
31- # 3. Generate SHA256 Checksums
31+ # 3. Create Distribution Zip
32+ $ZipPath = Join-Path $ArtifactsDir " cloudsqlctl-windows-x64.zip"
33+ $FilesToZip = @ (
34+ (Join-Path $ArtifactsDir " cloudsqlctl.exe" ),
35+ (Join-Path $ArtifactsDir " cloudsqlctl-setup.exe" ),
36+ (Join-Path $Root " README.md" ),
37+ (Join-Path $Root " LICENSE" ),
38+ (Join-Path $Root " docs/commands.md" ),
39+ (Join-Path $Root " CHANGELOG.md" )
40+ )
41+
42+ # Filter existing files only
43+ $FilesToZip = $FilesToZip | Where-Object { Test-Path $_ }
44+
45+ Compress-Archive - Path $FilesToZip - DestinationPath $ZipPath - Force
46+
47+ # 4. Generate SHA256 Checksums
3248$ChecksumFile = Join-Path $ArtifactsDir " SHA256SUMS.txt"
3349
3450function Get-Sha256Hash {
@@ -46,26 +62,11 @@ function Get-Sha256Hash {
4662 }
4763}
4864
49- Get-ChildItem $ArtifactsDir - Filter " *.exe" | ForEach-Object {
65+ $ArtifactsToHash = Get-ChildItem $ArtifactsDir | Where-Object { $_.Extension -in @ (' .exe' , ' .zip' ) } | Sort-Object Name
66+ $ArtifactsToHash | ForEach-Object {
5067 $hash = Get-Sha256Hash - FilePath $_.FullName
5168 " $hash $ ( $_.Name ) "
5269} | Out-File - Encoding ASCII $ChecksumFile
5370
54- # 4. Create Distribution Zip
55- $ZipPath = Join-Path $ArtifactsDir " cloudsqlctl-windows-x64.zip"
56- $FilesToZip = @ (
57- (Join-Path $ArtifactsDir " cloudsqlctl.exe" ),
58- (Join-Path $ArtifactsDir " cloudsqlctl-setup.exe" ),
59- (Join-Path $Root " README.md" ),
60- (Join-Path $Root " LICENSE" ),
61- (Join-Path $Root " docs/commands.md" ),
62- (Join-Path $Root " CHANGELOG.md" )
63- )
64-
65- # Filter existing files only
66- $FilesToZip = $FilesToZip | Where-Object { Test-Path $_ }
67-
68- Compress-Archive - Path $FilesToZip - DestinationPath $ZipPath - Force
69-
7071Write-Host " Artifacts staged successfully in $ArtifactsDir "
7172Get-ChildItem $ArtifactsDir | Select-Object Name, Length
0 commit comments