8000 Update build scripts by jborean93 · Pull Request #4 · jborean93/PSToml · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update build scripts #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ jobs:
run: ./build.ps1 -Configuration $env:BUILD_CONFIGURATION -Task Build
if: ${{ env.BUILD_CONFIGURATION == 'Release' }}
env:
PSMODULE_SIGNING_CERT: ${{ secrets.PSMODULE_SIGNING_CERT }}
PSMODULE_SIGNING_CERT_PASSWORD: ${{ secrets.PSMODULE_SIGNING_CERT_PASSWORD }}
AZURE_KEYVAULT_CREDENTIALS: ${{ secrets.AZURE_KEYVAULT_CREDENTIALS }}

- name: Capture PowerShell Module
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -141,7 +140,7 @@ jobs:
needs:
- build
- test
runs-on: windows-latest
runs-on: ubuntu-latest
steps:
- name: Restore Built PowerShell Module
uses: actions/download-artifact@v3
Expand Down
20 changes: 14 additions & 6 deletions PSToml.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,24 @@ task CopyToRelease {
}

task Sign {
$certPath = $env:PSMODULE_SIGNING_CERT
$certPassword = $env:PSMODULE_SIGNING_CERT_PASSWORD
if (-not $certPath -or -not $certPassword) {
if (-not $env:AZURE_KEYVAULT_CREDENTIALS) {
return
}

[byte[]]$certBytes = [System.Convert]::FromBase64String($env:PSMODULE_SIGNING_CERT)
$cert = [System.Security.Cryptography.X509Certificates.X509Certificate2]::new($certBytes, $certPassword)
$credInfo = ConvertFrom-Json -InputObject $env:AZURE_KEYVAULT_CREDENTIALS
$vaultName = $credInfo.vaultName
$vaultCert = $credInfo.vaultCert

$env:AZURE_CLIENT_ID = $credInfo.clientId
$env:AZURE_CLIENT_SECRET = $credInfo.clientSecret
$env:AZURE_TENANT_ID = $credInfo.tenantId
$key = Get-OpenAuthenticodeAzKey -Vault $vaultName -Certificate $vaultCert
$env:AZURE_CLIENT_ID = ''
$env:AZURE_CLIENT_SECRET = ''
$env:AZURE_TENANT_ID = ''

$signParams = @{
Certificate = $cert
Key = $key
TimeStampServer = 'http://timestamp.digicert.com'
HashAlgorithm = 'SHA256'
}
Expand Down
0