@@ -83,12 +83,51 @@ jobs:
8383 TAURI_SIGNING_PRIVATE_KEY_PASSWORD : ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
8484 run : |
8585 cd frontend
86- # Decode the Base64 private key to a file to avoid newline issues
87- $keyContent = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($env:TAURI_SIGNING_PRIVATE_KEY))
88- $keyContent | Out-File -FilePath "tauri.key" -Encoding utf8 -NoNewline
8986
90- # Set the environment variable to the content of the file (or path if Tauri supports it, but content is safer)
91- $env:TAURI_SIGNING_PRIVATE_KEY = Get-Content "tauri.key" -Raw
87+ Write-Output "=== Debugging Signing Key Setup ==="
88+
89+ # Check Password
90+ if ($env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD) {
91+ Write-Output "Password env var is set (length: $($env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD.Length))"
92+ } else {
93+ Write-Warning "Password env var is EMPTY"
94+ }
95+
96+ # Decode Base64 directly to bytes and write to file (avoids BOM/encoding issues)
97+ try {
98+ $bytes = [System.Convert]::FromBase64String($env:TAURI_SIGNING_PRIVATE_KEY)
99+ [System.IO.File]::WriteAllBytes("$PWD/tauri.key", $bytes)
100+ Write-Output "Successfully decoded key to tauri.key"
101+ } catch {
102+ Write-Error "Failed to decode Base64 key: $_"
103+ exit 1
104+ }
105+
106+ # Debug: Check file content (Hex dump start)
107+ if (Test-Path "tauri.key") {
108+ $len = (Get-Item 'tauri.key').Length
109+ Write-Output "Key file created. Size: $len bytes"
110+
111+ # Hex dump first 16 bytes to check for BOM or corruption
112+ # Note: In PS 5.1 use -Encoding Byte
113+ $head = Get-Content "tauri.key" -Encoding Byte -TotalCount 16
114+ $hex = ($head | ForEach-Object { '{0:X2}' -f $_ }) -join ' '
115+ Write-Output "File Head (Hex): $hex"
116+
117+ # Verify header text
118+ $firstLine = Get-Content "tauri.key" -TotalCount 1
119+ Write-Output "First line text: $firstLine"
120+
121+ if ($firstLine -notmatch "^untrusted comment:") {
122+ Write-Warning "Key file does not start with 'untrusted comment:'"
123+ }
124+ }
125+
126+ # Strategy: Pass the FILE PATH to Tauri
127+ # This bypasses any environment variable string corruption issues
128+ $keyPath = (Resolve-Path "tauri.key").Path
129+ $env:TAURI_SIGNING_PRIVATE_KEY = $keyPath
130+ Write-Output "Setting TAURI_SIGNING_PRIVATE_KEY to path: $keyPath"
92131
93132 npm run tauri build
94133
0 commit comments