Skip to content

Commit 18410be

Browse files
committed
Updated pipeline to only sign our own binaries.
1 parent ff598b6 commit 18410be

1 file changed

Lines changed: 45 additions & 19 deletions

File tree

.github/workflows/build.yml

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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", "SFTPSyncStop/bin/Release/net8.0-windows", "SFTPSyncUI/bin/Release/net8.0-windows")
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

Comments
 (0)