Skip to content

Commit 47dbf35

Browse files
committed
Make key decoding robust: handle both Base64 and raw text secrets
1 parent dea2e9f commit 47dbf35

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,15 @@ jobs:
9595
9696
# Decode Base64 directly to bytes and write to file (avoids BOM/encoding issues)
9797
try {
98+
# Try to decode as Base64 first (in case user encoded the key file)
9899
$bytes = [System.Convert]::FromBase64String($env:TAURI_SIGNING_PRIVATE_KEY)
99100
[System.IO.File]::WriteAllBytes("$PWD/tauri.key", $bytes)
100-
Write-Output "Successfully decoded key to tauri.key"
101+
Write-Output "Successfully decoded Base64 key to tauri.key"
101102
} catch {
102-
Write-Error "Failed to decode Base64 key: $_"
103-
exit 1
103+
# If Base64 decoding fails, assume it's the raw text content of the key
104+
Write-Output "Secret is not Base64, assuming raw key content."
105+
$env:TAURI_SIGNING_PRIVATE_KEY | Out-File -FilePath "tauri.key" -Encoding utf8 -NoNewline
106+
Write-Output "Saved raw key content to tauri.key"
104107
}
105108
106109
# Debug: Check file content (Hex dump start)

0 commit comments

Comments
 (0)