|
14 | 14 | env: |
15 | 15 | PYTHON_VERSION: '3.11' |
16 | 16 | NODE_VERSION: '18' |
17 | | - # Tauri updater signing key (set in GitHub Secrets) |
18 | | - # TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} |
19 | | - # TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} |
| 17 | + # Password is passed directly (can be empty) |
| 18 | + TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} |
20 | 19 |
|
21 | 20 | jobs: |
22 | 21 | build-windows: |
@@ -76,92 +75,37 @@ jobs: |
76 | 75 | run: | |
77 | 76 | copy backend\dist\backend_server-x86_64-pc-windows-msvc.exe frontend\src-tauri\ |
78 | 77 |
|
79 | | - # Build the final application with signing enabled |
80 | | - - name: Build Tauri application |
81 | | - env: |
82 | | - TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} |
83 | | - TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} |
| 78 | + # Decode the secret and set the environment variable for the next step |
| 79 | + - name: Setup Signing Key |
84 | 80 | run: | |
85 | | - cd frontend |
86 | | - |
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 | | - # Try to decode as Base64 first (in case user encoded the key file) |
99 | | - $bytes = [System.Convert]::FromBase64String($env:TAURI_SIGNING_PRIVATE_KEY) |
100 | | - [System.IO.File]::WriteAllBytes("$PWD/tauri.key", $bytes) |
101 | | - Write-Output "Successfully decoded Base64 key to tauri.key" |
102 | | - } catch { |
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 | | - # Explicitly use UTF-8 NO BOM and Trim whitespace |
106 | | - $keyContent = $env:TAURI_SIGNING_PRIVATE_KEY.Trim() |
107 | | - $encoding = New-Object System.Text.UTF8Encoding $false |
108 | | - [System.IO.File]::WriteAllText("$PWD/tauri.key", $keyContent, $encoding) |
109 | | - Write-Output "Saved raw key content to tauri.key" |
110 | | - } |
| 81 | + # 1. Get the Base64 secret |
| 82 | + $encoded = "${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}" |
111 | 83 | |
112 | | - # Debug: Check file content (Hex dump start) |
113 | | - if (Test-Path "tauri.key") { |
114 | | - $len = (Get-Item 'tauri.key').Length |
115 | | - Write-Output "Key file created. Size: $len bytes" |
| 84 | + if ($encoded) { |
| 85 | + # 2. Decode Base64 to text |
| 86 | + $bytes = [System.Convert]::FromBase64String($encoded) |
| 87 | + $decodedKey = [System.Text.Encoding]::UTF8.GetString($bytes) |
116 | 88 | |
117 | | - # Hex dump first 16 bytes to check for BOM or corruption |
118 | | - # Using Format-Hex which is available in PS 5.1 and Core |
119 | | - try { |
120 | | - $hex = Format-Hex -Path "tauri.key" -Count 16 | Out-String |
121 | | - Write-Output "File Head (Hex):`n$hex" |
122 | | - } catch { |
123 | | - Write-Warning "Could not run Format-Hex: $_" |
124 | | - } |
| 89 | + # 3. Write to a temporary file (frontend/tauri.key) |
| 90 | + $keyPath = Join-Path (Get-Location) "frontend/tauri.key" |
| 91 | + [System.IO.File]::WriteAllText($keyPath, $decodedKey) |
125 | 92 | |
126 | | - # Verify header text |
127 | | - $firstLine = Get-Content "tauri.key" -TotalCount 1 |
128 | | - Write-Output "First line text: $firstLine" |
| 93 | + # 4. Set the environment variable to the FILE PATH |
| 94 | + # This is the equivalent of 'export' but for GitHub Actions Windows runners |
| 95 | + echo "TAURI_SIGNING_PRIVATE_KEY=$keyPath" >> $env:GITHUB_ENV |
129 | 96 | |
130 | | - if ($firstLine -notmatch "^untrusted comment:") { |
131 | | - Write-Warning "Key file does not start with 'untrusted comment:'" |
132 | | - } |
| 97 | + Write-Host "Success: Signing key decoded and saved to $keyPath" |
| 98 | + } else { |
| 99 | + Write-Warning "TAURI_SIGNING_PRIVATE_KEY secret is missing!" |
133 | 100 | } |
134 | | - |
135 | | - # Strategy: Pass the content to Tauri |
136 | | - # We reload it from the file to ensure we use the clean version we just wrote |
137 | | - $env:TAURI_SIGNING_PRIVATE_KEY = [System.IO.File]::ReadAllText("$PWD/tauri.key") |
138 | | - Write-Output "Setting TAURI_SIGNING_PRIVATE_KEY to clean key content (length: $($env:TAURI_SIGNING_PRIVATE_KEY.Length))" |
139 | | - |
140 | | - npm run tauri build |
141 | 101 |
|
142 | | - # Debug: List all files in bundle directory to see if .sig files were created |
143 | | - - name: Debug - List bundle files |
| 102 | + # Build the final application |
| 103 | + - name: Build Tauri application |
144 | 104 | run: | |
145 | | - Write-Output "=== Checking if signing key is set ===" |
146 | | - if ($env:TAURI_SIGNING_PRIVATE_KEY) { |
147 | | - Write-Output "TAURI_SIGNING_PRIVATE_KEY is SET (length: $($env:TAURI_SIGNING_PRIVATE_KEY.Length))" |
148 | | - } else { |
149 | | - Write-Output "WARNING: TAURI_SIGNING_PRIVATE_KEY is NOT SET - signatures will be empty!" |
150 | | - } |
151 | | - |
152 | | - Write-Output "`n=== Files in msi folder ===" |
153 | | - Get-ChildItem -Path "frontend\src-tauri\target\release\bundle\msi" -Recurse | ForEach-Object { Write-Output $_.FullName } |
154 | | - |
155 | | - Write-Output "`n=== Files in nsis folder (if exists) ===" |
156 | | - if (Test-Path "frontend\src-tauri\target\release\bundle\nsis") { |
157 | | - Get-ChildItem -Path "frontend\src-tauri\target\release\bundle\nsis" -Recurse | ForEach-Object { Write-Output $_.FullName } |
158 | | - } |
159 | | - |
160 | | - Write-Output "`n=== Looking for .sig files ===" |
161 | | - Get-ChildItem -Path "frontend\src-tauri\target\release\bundle" -Recurse -Filter "*.sig" | ForEach-Object { |
162 | | - Write-Output "Found signature: $($_.FullName)" |
163 | | - Write-Output "Content: $(Get-Content $_.FullName -Raw)" |
164 | | - } |
| 105 | + cd frontend |
| 106 | + npm run tauri build |
| 107 | +
|
| 108 | +
|
165 | 109 |
|
166 | 110 | # Generate checksums for verification |
167 | 111 | - name: Generate checksums |
|
0 commit comments