Skip to content

Commit f665e66

Browse files
committed
setup tauri updater
1 parent 1d40cd0 commit f665e66

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

scripts/set-updater-env.ps1

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
param(
2+
[string]$KeyPath = "$HOME\.tauri\devstack.key",
3+
[string]$PubKeyPath = "$HOME\.tauri\devstack.key.pub",
4+
[string]$Password,
5+
[string]$Endpoint = "https://github.com/holdon1996/dev-stack/releases/latest/download/latest.json"
6+
)
7+
8+
if (-not (Test-Path -LiteralPath $KeyPath)) {
9+
throw "Private key not found: $KeyPath"
10+
}
11+
12+
if (-not (Test-Path -LiteralPath $PubKeyPath)) {
13+
throw "Public key not found: $PubKeyPath"
14+
}
15+
16+
if ([string]::IsNullOrWhiteSpace($Password)) {
17+
$secure = Read-Host "Enter updater key password" -AsSecureString
18+
$bstr = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($secure)
19+
try {
20+
$Password = [Runtime.InteropServices.Marshal]::PtrToStringBSTR($bstr)
21+
} finally {
22+
[Runtime.InteropServices.Marshal]::ZeroFreeBSTR($bstr)
23+
}
24+
}
25+
26+
$env:TAURI_SIGNING_PRIVATE_KEY = $KeyPath
27+
$env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD = $Password
28+
$env:TAURI_UPDATER_PUBKEY = Get-Content -LiteralPath $PubKeyPath -Raw
29+
$env:TAURI_UPDATER_ENDPOINT = $Endpoint
30+
31+
Write-Host "Updater build environment is ready for this PowerShell session." -ForegroundColor Green
32+
Write-Host "TAURI_SIGNING_PRIVATE_KEY=$env:TAURI_SIGNING_PRIVATE_KEY"
33+
Write-Host "TAURI_UPDATER_ENDPOINT=$env:TAURI_UPDATER_ENDPOINT"

src-tauri/tauri.conf.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
"shell": {},
5252
"fs": {},
5353
"updater": {
54+
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDIwMEI4NDcyNzY2OTMwQ0MKUldUTU1HbDJjb1FMSUNpSmsrZzdGL3hjSDVpaGgwSTFWS3VnclB4ZGR5YTdrYW1CTElWekpPSzQK",
55+
"endpoints": [
56+
"https://github.com/holdon1996/dev-stack/releases/latest/download/latest.json"
57+
],
5458
"windows": {
5559
"installMode": "passive"
5660
}

0 commit comments

Comments
 (0)