diff --git a/.github/actions/setup-windows-signing/action.yml b/.github/actions/setup-windows-signing/action.yml deleted file mode 100644 index 2787bc2..0000000 --- a/.github/actions/setup-windows-signing/action.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: "Setup Windows Code Signing" -description: "Configure EV code signing for Windows builds using GCP KMS" - -inputs: - ev_signing_cert: - description: "Base64-encoded EV signing certificate chain (PEM)" - required: false - gcp_workload_id_provider: - description: "GCP Workload Identity Provider" - required: false - gcp_service_account: - description: "GCP Service Account" - required: false - -outputs: - gcloud_access_token: - description: "GCP access token for signing" - value: ${{ steps.gcloud_auth.outputs.access_token }} - -runs: - using: "composite" - steps: - - name: Setup Java - uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0 - with: - distribution: "zulu" - java-version: "11.0" - - - name: Authenticate to Google Cloud - id: gcloud_auth - if: inputs.gcp_workload_id_provider != '' - uses: google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8 - with: - workload_identity_provider: ${{ inputs.gcp_workload_id_provider }} - service_account: ${{ inputs.gcp_service_account }} - token_format: "access_token" - - - name: Setup code signing - shell: pwsh - run: | # zizmor: ignore[github-env] - if (-not $env:EV_SIGNING_CERT) { - Write-Host "⚠️ No Windows code signing certificate provided - building unsigned" - exit 0 - } - - # Decode base64-encoded certificate chain and save to temp file - $certContent = [System.Text.Encoding]::UTF8.GetString( - [System.Convert]::FromBase64String($env:EV_SIGNING_CERT) - ) - $certPath = Join-Path $env:TEMP "ev_cert.pem" - Set-Content -Path $certPath -Value $certContent -NoNewline - Add-Content -Path $env:GITHUB_ENV -Value "EV_CERTIFICATE_PATH=$certPath" - - # Download jsign - $jsignPath = Join-Path $env:TEMP "jsign-6.0.jar" - Invoke-WebRequest -Uri "https://github.com/ebourg/jsign/releases/download/6.0/jsign-6.0.jar" -OutFile $jsignPath - Add-Content -Path $env:GITHUB_ENV -Value "JSIGN_PATH=$jsignPath" - - Write-Host "✅ Windows EV code signing configured" - env: - EV_SIGNING_CERT: ${{ inputs.ev_signing_cert }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c247998..3040df5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,10 +11,6 @@ jobs: release: permissions: contents: write - id-token: write # GCP workload identity for Windows code signing - # The EV signing service account (coder-ci) only trusts jobs in this - # environment, which only main and v* tags may use. - environment: code-signing strategy: fail-fast: false matrix: @@ -79,57 +75,9 @@ jobs: - run: npm ci - # --- Windows EV code signing via GCP Cloud KMS --- - - name: Setup Windows code signing - id: windows_signing - if: matrix.platform == 'windows-latest' - uses: ./.github/actions/setup-windows-signing - with: - ev_signing_cert: ${{ secrets.EV_SIGNING_CERT }} - gcp_workload_id_provider: ${{ vars.GCP_WORKLOAD_ID_PROVIDER }} - gcp_service_account: ${{ vars.GCP_SERVICE_ACCOUNT }} - - - name: Configure Tauri Windows signCommand - if: matrix.platform == 'windows-latest' && env.JSIGN_PATH != '' - shell: pwsh - run: | - # Resolve absolute paths — Tauri's bundler uses std::process::Command - # (no shell) so bare names like 'pwsh' fail PATH lookup on Windows. - $pwshPath = (Get-Command pwsh).Source -replace '\\', '/' - $scriptPath = (Resolve-Path "scripts/sign-windows.ps1").Path -replace '\\', '/' - $config = @{ - bundle = @{ - windows = @{ - signCommand = @{ - cmd = $pwshPath - args = @("-File", $scriptPath, "%1") - } - } - } - } | ConvertTo-Json -Depth 10 - $config | Set-Content signing.conf.json - Write-Host "signing.conf.json:" - Get-Content signing.conf.json - Add-Content -Path $env:GITHUB_ENV -Value "SIGNING_ARGS=--config signing.conf.json" - - uses: tauri-apps/tauri-action@84b9d35b5fc46c1e45415bdb6144030364f7ebc5 # v0.6.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Enable bundler debug logging — sign command stdout/stderr is - # swallowed on failure; RUST_LOG surfaces the command invocation. - RUST_LOG: tauri_bundler=debug - # macOS signing & notarization (optional — skipped if not set) - APPLE_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} - APPLE_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PWD }} - APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - # Windows EV signing env vars (used by scripts/sign-windows.ps1) - EV_KEYSTORE: ${{ vars.EV_KEYSTORE }} - EV_KEY: ${{ vars.EV_KEY }} - EV_TSA_URL: ${{ vars.EV_TSA_URL }} - GCLOUD_ACCESS_TOKEN: ${{ steps.windows_signing.outputs.gcloud_access_token }} # Updater signing (optional — only set when the secret exists) TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY || '' }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD || '' }} @@ -139,28 +87,4 @@ jobs: releaseBody: "See the assets below to download and install this version." releaseDraft: true prerelease: false - args: ${{ matrix.args }} ${{ env.SIGNING_ARGS }} - - # Dump sign script log on failure — Tauri bundler swallows subprocess - # stdout/stderr when the sign command exits non-zero, making failures - # invisible. The script writes a transcript to $RUNNER_TEMP/sign-windows.log. - - name: Dump signing log on failure - if: failure() && matrix.platform == 'windows-latest' - shell: pwsh - run: | - $logFile = Join-Path $env:RUNNER_TEMP "sign-windows.log" - if (Test-Path $logFile) { - Write-Host "=== sign-windows.log ===" - Get-Content $logFile - Write-Host "=== end sign-windows.log ===" - } else { - Write-Host "No sign-windows.log found at $logFile" - Write-Host "Sign script may not have been invoked, or RUNNER_TEMP differs." - Write-Host "Checking TEMP fallback..." - $fallback = Join-Path $env:TEMP "sign-windows.log" - if (Test-Path $fallback) { - Get-Content $fallback - } else { - Write-Host "No log file found at $fallback either." - } - } + args: ${{ matrix.args }} diff --git a/.gitignore b/.gitignore index bea37db..e404292 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,4 @@ src-tauri/target/ *.swp *.swo src-tauri/gen/ -signing.conf.json diff --git a/scripts/sign-windows.ps1 b/scripts/sign-windows.ps1 deleted file mode 100644 index c7b407c..0000000 --- a/scripts/sign-windows.ps1 +++ /dev/null @@ -1,126 +0,0 @@ -# Windows EV code signing script for Tauri signCommand -# Uses jsign with GCP Cloud KMS for EV certificate signing -# -# Called by Tauri as: pwsh -File scripts/sign-windows.ps1 -# -# NOTE: Tauri's bundler swallows stdout/stderr from sign commands on failure -# (output_ok() discards output on non-zero exit). All diagnostic output is -# tee'd to a log file so a post-failure workflow step can dump it. -# -# Required environment variables: -# JSIGN_PATH - Path to jsign JAR file -# EV_KEYSTORE - GCP Cloud KMS keystore URL -# EV_KEY - Key alias in the keystore -# EV_CERTIFICATE_PATH - Path to the EV certificate PEM file -# EV_TSA_URL - Timestamp server URL -# GCLOUD_ACCESS_TOKEN - GCP access token for authentication - -param( - [Parameter(Mandatory=$true, Position=0)] - [string]$FilePath -) - -# Log to file since Tauri bundler discards subprocess output on failure -$logDir = if ($env:RUNNER_TEMP) { $env:RUNNER_TEMP } else { $env:TEMP } -$logFile = Join-Path $logDir "sign-windows.log" -Start-Transcript -Path $logFile -Append -Force | Out-Null - -Write-Host "=== sign-windows.ps1 started at $(Get-Date -Format o) ===" -Write-Host "FilePath: $FilePath" -Write-Host "PID: $PID" -Write-Host "PowerShell: $($PSVersionTable.PSVersion)" - -# Check if signing is configured -if (-not $env:JSIGN_PATH -or -not $env:EV_KEYSTORE) { - Write-Host "Windows code signing not configured - skipping $FilePath" - Stop-Transcript | Out-Null - exit 0 -} - -# Validate required environment variables -$requiredVars = @( - "JSIGN_PATH", - "EV_KEYSTORE", - "EV_KEY", - "EV_CERTIFICATE_PATH", - "EV_TSA_URL", - "GCLOUD_ACCESS_TOKEN" -) - -foreach ($varName in $requiredVars) { - $val = [System.Environment]::GetEnvironmentVariable($varName) - if (-not $val) { - Write-Error "Missing required environment variable: $varName" - Stop-Transcript | Out-Null - exit 1 - } - # Log presence without leaking secrets - $display = if ($varName -eq "GCLOUD_ACCESS_TOKEN") { "***($($val.Length) chars)" } else { $val } - Write-Host "${varName}: $display" -} - -# Verify file exists -if (-not (Test-Path $FilePath)) { - Write-Error "File not found: $FilePath" - Stop-Transcript | Out-Null - exit 1 -} -Write-Host "File exists: $FilePath ($($(Get-Item $FilePath).Length) bytes)" - -# Verify java is available -$javaCmd = Get-Command java -ErrorAction SilentlyContinue -if (-not $javaCmd) { - Write-Error "java not found in PATH" - Write-Host "PATH: $env:PATH" - Stop-Transcript | Out-Null - exit 1 -} -Write-Host "Java: $($javaCmd.Source)" - -# Verify jsign jar exists -if (-not (Test-Path $env:JSIGN_PATH)) { - Write-Error "jsign jar not found: $env:JSIGN_PATH" - Stop-Transcript | Out-Null - exit 1 -} - -# Verify certificate exists -if (-not (Test-Path $env:EV_CERTIFICATE_PATH)) { - Write-Error "Certificate file not found: $env:EV_CERTIFICATE_PATH" - Stop-Transcript | Out-Null - exit 1 -} - -Write-Host "Signing $FilePath with EV certificate..." - -$jsignArgs = @( - "-jar", $env:JSIGN_PATH, - "--storetype", "GOOGLECLOUD", - "--storepass", $env:GCLOUD_ACCESS_TOKEN, - "--keystore", $env:EV_KEYSTORE, - "--alias", $env:EV_KEY, - "--certfile", $env:EV_CERTIFICATE_PATH, - "--tsmode", "RFC3161", - "--tsaurl", $env:EV_TSA_URL, - $FilePath -) - -# Log the command (mask the access token) -$displayArgs = $jsignArgs.Clone() -$storepassIdx = [Array]::IndexOf($displayArgs, "--storepass") -if ($storepassIdx -ge 0 -and ($storepassIdx + 1) -lt $displayArgs.Length) { - $displayArgs[$storepassIdx + 1] = "***" -} -Write-Host "Running: java $($displayArgs -join ' ')" - -& java @jsignArgs 2>&1 | ForEach-Object { Write-Host $_ } -$exitCode = $LASTEXITCODE - -if ($exitCode -ne 0) { - Write-Error "Failed to sign $FilePath (exit code: $exitCode)" - Stop-Transcript | Out-Null - exit $exitCode -} - -Write-Host "Successfully signed $FilePath" -Stop-Transcript | Out-Null