4141 --configuration Release `
4242 --runtime win-x64 `
4343 --self-contained true `
44- --output SFTPSync/bin/Release/net8.0-windows/publish/win-x64/ `
44+ --output SFTPSync/bin/Release/net8.0-windows `
4545 /p:PublishSingleFile=true `
4646 /p:PublishReadyToRun=true
4747
5151 --configuration Release `
5252 --runtime win-x64 `
5353 --self-contained true `
54- --output SFTPSyncStop/bin/Release/net8.0-windows/publish/win-x64/ `
54+ --output SFTPSyncStop/bin/Release/net8.0-windows `
5555 /p:PublishSingleFile=true `
5656 /p:PublishReadyToRun=true
5757
6161 --configuration Release `
6262 --runtime win-x64 `
6363 --self-contained true `
64- --output SFTPSyncUI/bin/Release/net8.0-windows/publish/win-x64/ `
64+ --output SFTPSyncUI/bin/Release/net8.0-windows `
6565 /p:PublishSingleFile=true `
6666 /p:PublishReadyToRun=true
6767
@@ -75,26 +75,52 @@ jobs:
7575 AZURE_CERT_NAME : ${{ secrets.AZURE_CERT_NAME }}
7676 shell : pwsh
7777 run : |
78- $publishDirs = @("SFTPSync/bin/Release/net8.0-windows/publish/win-x64", "SFTPSyncStop/bin/Release/net8.0-windows/publish/win-x64", "SFTPSyncUI/bin/Release/net8.0-windows/publish/win-x64")
79- foreach ($dir in $publishDirs) {
80- if (Test-Path $dir) {
81- $files = Get-ChildItem -Path $dir -Include *.exe, *.dll -Recurse
82- foreach ($file in $files) {
83- Write-Host "Signing $($file.FullName)"
84- AzureSignTool sign `
85- -kvu $env:AZURE_KEY_VAULT_URL `
86- -kvi $env:AZURE_APPLICATION_ID `
87- -kvs $env:AZURE_CLIENT_SECRET `
88- -kvt $env:AZURE_TENANT_ID `
89- -kvc $env:AZURE_CERT_NAME `
90- -tr http://timestamp.digicert.com `
91- -fd sha256 `
92- -td sha256 `
93- $file.FullName
94- }
95- } else {
96- Write-Host "Directory $dir not found"
78+ $solutionPath = "SFTPSync.sln"
79+ $projectPaths = @()
80+ $projectMatches = Select-String -Path $solutionPath -Pattern 'Project\(\".*\"\)\s=\s\".*\",\s\"(?<path>[^\"]+\.csproj)\"'
81+ foreach ($match in $projectMatches) {
82+ $projectPaths += $match.Matches[0].Groups["path"].Value
83+ }
84+
85+ $targets = @()
86+ foreach ($projectPath in $projectPaths) {
87+ if (!(Test-Path $projectPath)) {
88+ Write-Host "Project not found: $projectPath"
89+ continue
90+ }
91+
92+ [xml]$projXml = Get-Content $projectPath
93+ $assemblyName = ($projXml.Project.PropertyGroup | Where-Object { $_.AssemblyName } | Select-Object -First 1).AssemblyName
94+ if ([string]::IsNullOrWhiteSpace($assemblyName)) {
95+ $assemblyName = [System.IO.Path]::GetFileNameWithoutExtension($projectPath)
96+ }
97+
98+ $outputType = ($projXml.Project.PropertyGroup | Where-Object { $_.OutputType } | Select-Object -First 1).OutputType
99+ $extension = if ($outputType -in @("Exe", "WinExe")) { ".exe" } else { ".dll" }
100+
101+ $projectDir = Split-Path $projectPath -Parent
102+ $releaseDir = Join-Path $projectDir "bin/Release"
103+ if (!(Test-Path $releaseDir)) {
104+ Write-Host "Release output not found: $releaseDir"
105+ continue
97106 }
107+
108+ $targets += Get-ChildItem -Path $releaseDir -Recurse -Filter "$assemblyName$extension"
109+ }
110+
111+ $targets = $targets | Sort-Object -Property FullName -Unique
112+ foreach ($file in $targets) {
113+ Write-Host "Signing $($file.FullName)"
114+ AzureSignTool sign `
115+ -kvu $env:AZURE_KEY_VAULT_URL `
116+ -kvi $env:AZURE_APPLICATION_ID `
117+ -kvs $env:AZURE_CLIENT_SECRET `
118+ -kvt $env:AZURE_TENANT_ID `
119+ -kvc $env:AZURE_CERT_NAME `
120+ -tr http://timestamp.digicert.com `
121+ -fd sha256 `
122+ -td sha256 `
123+ $file.FullName
98124 }
99125
100126 - name : Add WiX Toolset to PATH
0 commit comments