@@ -507,23 +507,23 @@ Add-BuildTask Build {
507507 Write-Build Gray ' ...Docs output completed.'
508508 }
509509
510- # Sign our files if we're running on main.
511- # if (($canSign = ($env:GITHUB_ACTIONS -eq 'true') -and ($env:GITHUB_REF_NAME -match '^(main|develop)$')))
512- # {
513- # if (!(Get-Command -Name 'azuresigntool' -ErrorAction Ignore))
514- # {
515- # throw 'AzureSignTool not found.'
516- # }
517- # Write-Build Gray ' Signing module...'
518- # Get-ChildItem -Path $Script:BuildModuleRoot -Include '*.ps*1' -Recurse | ForEach-Object {
519- # & azuresigntool sign -s -kvu https://psadt-kv-prod-codesign.vault.azure.net -kvc PSADT -kvm -tr http://timestamp.digicert.com -td sha256 "$_"
520- # if ($LASTEXITCODE -ne 0) { throw "Failed to sign file `"$_`". Exit code: $LASTEXITCODE" }
521- # }
522- # }
523- # else
524- # {
525- # Write-Build Yellow ' Not running main or develop branch in GitHub Actions, skipping code signing...'
526- # }
510+ # Sign our files if we're running on main or develop .
511+ if (($canSign = ($env: GITHUB_ACTIONS -eq ' true' ) -and ($env: GITHUB_REF_NAME -match ' ^(main|develop)$' )))
512+ {
513+ if (! (Get-Command - Name ' azuresigntool' - ErrorAction Ignore))
514+ {
515+ throw ' AzureSignTool not found.'
516+ }
517+ Write-Build Gray ' Signing module...'
518+ Get-ChildItem - Path $Script :BuildModuleRoot - Include ' *.ps*1' - Recurse | ForEach-Object {
519+ & azuresigntool sign - s - kvu https:// psadt- kv- prod- codesign.vault.azure.net - kvc PSADT - kvm - tr http:// timestamp.digicert.com - td sha256 " $_ "
520+ if ($LASTEXITCODE -ne 0 ) { throw " Failed to sign file `" $_ `" . Exit code: $LASTEXITCODE " }
521+ }
522+ }
523+ else
524+ {
525+ Write-Build Yellow ' Not running main or develop branch in GitHub Actions, skipping code signing...'
526+ }
527527
528528 Write-Build Green ' ...Build Complete!'
529529}
0 commit comments