Skip to content

Commit 60019a0

Browse files
authored
ci(release): add jetsocat ZIP files for winget distribution (#1526)
- Create platform-specific ZIP files (`jetsocat-<os>-<arch>.zip`) - Each ZIP contains standardized binary name (`jetsocat`/`jetsocat.exe`) - Remove original jetsocat binaries from release (ZIP files replace them)
1 parent f6ac60b commit 60019a0

1 file changed

Lines changed: 60 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,6 @@ jobs:
127127
gh run download ${{ needs.preflight.outputs.run }} -n webapp-client -n docker -n devolutions-gateway-signed -n native-libs --repo $Env:GITHUB_REPOSITORY
128128
Move-Item -Path devolutions-gateway-signed -Destination devolutions-gateway
129129
130-
## workflow_call: The same artifacts persist across the entire run, so the PowerShell/DevolutionsGateway directory will still exist from the CI workflow
131-
- name: Manage artifacts
132-
shell: pwsh
133-
run: Remove-Item -Path (Join-Path devolutions-gateway PowerShell DevolutionsGateway) -Recurse -ErrorAction Ignore
134-
135130
- name: Prepare artifacts
136131
id: prepare-artifacts
137132
shell: pwsh
@@ -236,15 +231,69 @@ jobs:
236231
- name: Manage artifacts
237232
shell: pwsh
238233
run: |
239-
# workflow_call: The same artifacts persist across the entire run, so the PowerShell/DevolutionsGateway directory will still exist from the CI workflow
240-
# FIXME: I suspect this line is no longer required.
241-
Remove-Item -Path (Join-Path devolutions-gateway PowerShell DevolutionsGateway) -Recurse -ErrorAction Ignore
242-
243234
# Devolutions Agent on Linux does not have any useful feature yet, so we filter out the Linux artifacts.
244-
Remove-Item -Path (Join-Path devolutions-agent linux) -Recurse -ErrorAction Ignore
235+
Remove-Item -Path (Join-Path devolutions-agent linux) -Recurse
236+
237+
# Do not upload tun2socks.exe by itself.
238+
Remove-Item -Path (Join-Path devolutions-agent tun2socks) -Recurse
245239
246240
# For the PowerShell module, only upload the nupkg.
247-
Remove-Item -Path (Join-Path devolutions-gateway PowerShell DevolutionsGateway-ps-*.tar) -Recurse -ErrorAction Ignore
241+
Remove-Item -Path (Join-Path devolutions-gateway PowerShell DevolutionsGateway-ps-*.tar)
242+
243+
- name: Create jetsocat ZIP files for winget
244+
shell: pwsh
245+
run: |
246+
Set-PSDebug -Trace 1
247+
248+
$Version = "${{ needs.preflight.outputs.version }}"
249+
$ZipFolder = "jetsocat-zips"
250+
New-Item -ItemType Directory -Path $ZipFolder -Force
251+
252+
# Define the platforms and architectures.
253+
$Platforms = @(
254+
@{ OS = "windows"; Arch = "x86_64"; Extension = ".exe" },
255+
@{ OS = "windows"; Arch = "arm64"; Extension = ".exe" },
256+
@{ OS = "linux"; Arch = "x86_64"; Extension = "" },
257+
@{ OS = "linux"; Arch = "arm64"; Extension = "" },
258+
@{ OS = "macos"; Arch = "x86_64"; Extension = "" },
259+
@{ OS = "macos"; Arch = "arm64"; Extension = "" }
260+
)
261+
262+
foreach ($Platform in $Platforms) {
263+
$OS = $Platform.OS
264+
$Arch = $Platform.Arch
265+
$Ext = $Platform.Extension
266+
267+
# Find the original binary.
268+
$BinaryPattern = "jetsocat_*_${Version}_${Arch}${Ext}"
269+
$OriginalBinary = Get-ChildItem -Recurse -Filter $BinaryPattern -File | Select-Object -First 1
270+
271+
if ($OriginalBinary) {
272+
# Create temporary folder for this zip.
273+
$TempFolder = Join-Path $ZipFolder "temp-$OS-$Arch"
274+
New-Item -ItemType Directory -Path $TempFolder -Force
275+
276+
# Copy binary with standard name.
277+
$TargetName = "jetsocat${Ext}"
278+
$TargetPath = Join-Path $TempFolder $TargetName
279+
Copy-Item -Path $OriginalBinary.FullName -Destination $TargetPath
280+
281+
# Create ZIP file.
282+
$ZipName = "jetsocat-$OS-$Arch.zip"
283+
$ZipPath = Join-Path $ZipFolder $ZipName
284+
Compress-Archive -Path $TargetPath -DestinationPath $ZipPath -Force
285+
286+
Write-Host "Created $ZipName"
287+
288+
# Clean up temp folder.
289+
Remove-Item -Path $TempFolder -Recurse -Force
290+
291+
# Remove the original binary to avoid uploading it.
292+
Remove-Item -Path $OriginalBinary.FullName
293+
} else {
294+
Write-Warning "Could not find binary for $OS $Arch"
295+
}
296+
}
248297
249298
- name: Create GitHub release
250299
shell: pwsh

0 commit comments

Comments
 (0)