Skip to content

Commit 073eb38

Browse files
juliusmarmingeJulius Marminge
andauthored
[codex] Fix Windows release signing setup (#2606)
Co-authored-by: Julius Marminge <julius@macmini.local>
1 parent 825263b commit 073eb38

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,62 @@ jobs:
244244
exit $code
245245
}
246246
247+
- name: Prepare Azure Trusted Signing
248+
if: matrix.platform == 'win'
249+
shell: pwsh
250+
env:
251+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
252+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
253+
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
254+
AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
255+
AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
256+
AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
257+
AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}
258+
run: |
259+
$ErrorActionPreference = "Stop"
260+
261+
$requiredSecrets = @(
262+
$env:AZURE_TENANT_ID,
263+
$env:AZURE_CLIENT_ID,
264+
$env:AZURE_CLIENT_SECRET,
265+
$env:AZURE_TRUSTED_SIGNING_ENDPOINT,
266+
$env:AZURE_TRUSTED_SIGNING_ACCOUNT_NAME,
267+
$env:AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME,
268+
$env:AZURE_TRUSTED_SIGNING_PUBLISHER_NAME
269+
)
270+
if ($requiredSecrets | Where-Object { [string]::IsNullOrWhiteSpace($_) }) {
271+
Write-Host "Azure Trusted Signing disabled; skipping TrustedSigning module preparation."
272+
exit 0
273+
}
274+
275+
Install-PackageProvider `
276+
-Name NuGet `
277+
-MinimumVersion 2.8.5.201 `
278+
-Force `
279+
-Scope CurrentUser
280+
281+
Install-Module `
282+
-Name TrustedSigning `
283+
-MinimumVersion 0.5.0 `
284+
-Force `
285+
-AllowClobber `
286+
-Repository PSGallery `
287+
-Scope CurrentUser
288+
289+
Import-Module TrustedSigning -MinimumVersion 0.5.0 -Force
290+
Get-Command Invoke-TrustedSigning -ErrorAction Stop
291+
292+
$moduleRoots = @(
293+
[System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "PowerShell", "Modules"),
294+
[System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "WindowsPowerShell", "Modules"),
295+
[System.IO.Path]::Combine($env:ProgramFiles, "PowerShell", "Modules"),
296+
[System.IO.Path]::Combine($env:ProgramFiles, "WindowsPowerShell", "Modules")
297+
)
298+
$modulePathEntries = @($moduleRoots + ($env:PSModulePath -split ";")) |
299+
Where-Object { $_ -and (Test-Path $_) } |
300+
Select-Object -Unique
301+
"PSModulePath=$($modulePathEntries -join ';')" >> $env:GITHUB_ENV
302+
247303
- name: Build desktop artifact
248304
shell: bash
249305
env:

0 commit comments

Comments
 (0)