Skip to content

Commit 2e6a7bd

Browse files
feat(p2): add optional signing to release workflow
1 parent 46785af commit 2e6a7bd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ jobs:
2424
with:
2525
ref: ${{ env.RELEASE_TAG }}
2626

27+
- name: Prepare signing certificate
28+
shell: pwsh
29+
env:
30+
CLOUDSQLCTL_SIGN_CERT_B64: ${{ secrets.CLOUDSQLCTL_SIGN_CERT_B64 }}
31+
CLOUDSQLCTL_SIGN_PWD: ${{ secrets.CLOUDSQLCTL_SIGN_PWD }}
32+
run: |
33+
if (-not $env:CLOUDSQLCTL_SIGN_CERT_B64) {
34+
Write-Host "Signing cert not provided; skipping signing setup."
35+
exit 0
36+
}
37+
$certPath = Join-Path $env:RUNNER_TEMP "cloudsqlctl-signing.pfx"
38+
[IO.File]::WriteAllBytes($certPath, [Convert]::FromBase64String($env:CLOUDSQLCTL_SIGN_CERT_B64))
39+
"CLOUDSQLCTL_SIGN_CERT=$certPath" | Out-File -FilePath $env:GITHUB_ENV -Append
40+
"CLOUDSQLCTL_SIGN_PWD=$env:CLOUDSQLCTL_SIGN_PWD" | Out-File -FilePath $env:GITHUB_ENV -Append
41+
2742
- name: Use Node.js 22.x
2843
uses: actions/setup-node@v4
2944
with:
@@ -54,6 +69,13 @@ jobs:
5469
- name: Build Installer
5570
run: npm run installer
5671

72+
- name: Sign artifacts
73+
if: ${{ env.CLOUDSQLCTL_SIGN_CERT != '' }}
74+
shell: pwsh
75+
run: |
76+
powershell -ExecutionPolicy Bypass -File tools/sign-exe.ps1 -ExePath "bin/cloudsqlctl.exe"
77+
powershell -ExecutionPolicy Bypass -File tools/sign-exe.ps1 -ExePath "dist/cloudsqlctl-setup.exe"
78+
5779
- name: Generate Docs
5880
run: npm run docs:generate
5981

0 commit comments

Comments
 (0)