@@ -19,6 +19,7 @@ const GITHUB_RELEASES_BASE = `https://github.com/${REPO_OWNER}/${REPO_NAME}/rele
19
19
// File paths
20
20
const CARGO_TOML_PATH = path . join ( __dirname , '..' , 'src-tauri' , 'Cargo.toml' ) ;
21
21
const PACKAGE_JSON_PATH = path . join ( __dirname , '..' , 'package.json' ) ;
22
+ const TAURI_CONF_PATH = path . join ( __dirname , '..' , 'src-tauri' , 'tauri.conf.json' ) ;
22
23
const LATEST_JSON_PATH = path . join ( __dirname , '..' , 'latest.json' ) ;
23
24
24
25
function getCurrentVersion ( ) {
@@ -40,7 +41,12 @@ function updateVersionFiles(version) {
40
41
packageJson . version = version ;
41
42
fs . writeFileSync ( PACKAGE_JSON_PATH , JSON . stringify ( packageJson , null , 2 ) + '\n' ) ;
42
43
43
- console . log ( '✅ Version files updated' ) ;
44
+ // Update tauri.conf.json
45
+ let tauriConf = JSON . parse ( fs . readFileSync ( TAURI_CONF_PATH , 'utf8' ) ) ;
46
+ tauriConf . version = version ;
47
+ fs . writeFileSync ( TAURI_CONF_PATH , JSON . stringify ( tauriConf , null , 2 ) + '\n' ) ;
48
+
49
+ console . log ( '✅ Version files updated (Cargo.toml, package.json, tauri.conf.json)' ) ;
44
50
}
45
51
46
52
function buildApp ( ) {
@@ -67,14 +73,6 @@ function extractSignatures(version) {
67
73
const bundleDir = path . join ( __dirname , '..' , 'src-tauri' , 'target' , 'release' , 'bundle' ) ;
68
74
const signatures = { } ;
69
75
70
- // Common platform mappings
71
- const platformMappings = {
72
- 'macos' : {
73
- 'x86_64' : 'darwin-x86_64' ,
74
- 'aarch64' : 'darwin-aarch64'
75
- }
76
- } ;
77
-
78
76
try {
79
77
// Look for .sig files
80
78
const findSigFiles = ( dir ) => {
@@ -86,44 +84,38 @@ function extractSignatures(version) {
86
84
87
85
const sigFiles = findSigFiles ( bundleDir ) ;
88
86
89
- for ( const sigFile of sigFiles ) {
90
- const signature = fs . readFileSync ( sigFile , 'utf8' ) . trim ( ) ;
91
- const fileName = path . basename ( sigFile , '.sig' ) ;
87
+ if ( sigFiles . length > 0 ) {
88
+ // For now, we assume single architecture build (most common)
89
+ // and use the same .app.tar.gz file for both platform entries
90
+ const signature = fs . readFileSync ( sigFiles [ 0 ] , 'utf8' ) . trim ( ) ;
92
91
93
- // Determine platform from filename
94
- let platform = 'darwin-aarch64' ; // default
95
- if ( fileName . includes ( 'x64' ) || fileName . includes ( 'x86_64' ) ) {
96
- platform = 'darwin-x86_64' ;
97
- }
92
+ // Use the actual Tauri-generated filename
93
+ const downloadUrl = `${ GITHUB_RELEASES_BASE } /v${ version } /Milo.app.tar.gz` ;
98
94
99
- // Determine download URL based on file type
100
- let downloadUrl ;
101
- if ( fileName . includes ( '.app.tar.gz' ) ) {
102
- downloadUrl = `${ GITHUB_RELEASES_BASE } /v${ version } /${ fileName } ` ;
103
- } else if ( fileName . includes ( '.dmg' ) ) {
104
- downloadUrl = `${ GITHUB_RELEASES_BASE } /v${ version } /${ fileName } ` ;
105
- } else {
106
- // Fallback naming
107
- const extension = platform === 'darwin-x86_64' ? 'x64.app.tar.gz' : 'aarch64.app.tar.gz' ;
108
- downloadUrl = `${ GITHUB_RELEASES_BASE } /v${ version } /Milo_${ extension } ` ;
109
- }
95
+ // Add both architectures pointing to the same universal file
96
+ signatures [ 'darwin-aarch64' ] = {
97
+ signature,
98
+ url : downloadUrl
99
+ } ;
110
100
111
- signatures [ platform ] = {
101
+ signatures [ 'darwin-x86_64' ] = {
112
102
signature,
113
103
url : downloadUrl
114
104
} ;
105
+
106
+ console . log ( `✅ Using signature from: ${ path . basename ( sigFiles [ 0 ] ) } ` ) ;
115
107
}
116
108
117
109
if ( Object . keys ( signatures ) . length === 0 ) {
118
110
console . warn ( '⚠️ No signature files found. Creating template structure...' ) ;
119
111
// Create template structure for manual completion
120
112
signatures [ 'darwin-aarch64' ] = {
121
113
signature : 'SIGNATURE_FROM_BUILD_PROCESS_AARCH64' ,
122
- url : `${ GITHUB_RELEASES_BASE } /v${ version } /Milo_aarch64 .app.tar.gz`
114
+ url : `${ GITHUB_RELEASES_BASE } /v${ version } /Milo .app.tar.gz`
123
115
} ;
124
116
signatures [ 'darwin-x86_64' ] = {
125
117
signature : 'SIGNATURE_FROM_BUILD_PROCESS_X64' ,
126
- url : `${ GITHUB_RELEASES_BASE } /v${ version } /Milo_x64 .app.tar.gz`
118
+ url : `${ GITHUB_RELEASES_BASE } /v${ version } /Milo .app.tar.gz`
127
119
} ;
128
120
}
129
121
@@ -136,11 +128,11 @@ function extractSignatures(version) {
136
128
return {
137
129
'darwin-aarch64' : {
138
130
signature : 'SIGNATURE_FROM_BUILD_PROCESS_AARCH64' ,
139
- url : `${ GITHUB_RELEASES_BASE } /v${ version } /Milo_aarch64 .app.tar.gz`
131
+ url : `${ GITHUB_RELEASES_BASE } /v${ version } /Milo .app.tar.gz`
140
132
} ,
141
133
'darwin-x86_64' : {
142
134
signature : 'SIGNATURE_FROM_BUILD_PROCESS_X64' ,
143
- url : `${ GITHUB_RELEASES_BASE } /v${ version } /Milo_x64 .app.tar.gz`
135
+ url : `${ GITHUB_RELEASES_BASE } /v${ version } /Milo .app.tar.gz`
144
136
}
145
137
} ;
146
138
}
@@ -178,6 +170,47 @@ function commitAndTag(version) {
178
170
}
179
171
}
180
172
173
+ function checkSigningKey ( ) {
174
+ console . log ( '🔐 Checking signing key setup...' ) ;
175
+
176
+ const keyPath = path . join ( process . env . HOME , '.tauri' , 'milo.key' ) ;
177
+ const envKey = process . env . TAURI_SIGNING_PRIVATE_KEY ;
178
+ const envPassword = process . env . TAURI_SIGNING_PRIVATE_KEY_PASSWORD ;
179
+
180
+ // Check if key file exists
181
+ if ( ! fs . existsSync ( keyPath ) ) {
182
+ console . error ( '❌ Signing key not found at ~/.tauri/milo.key' ) ;
183
+ console . log ( '\n🔧 To generate a new key:' ) ;
184
+ console . log ( 'pnpm tauri signer generate -w ~/.tauri/milo.key --password test123' ) ;
185
+ process . exit ( 1 ) ;
186
+ }
187
+
188
+ // Check if environment variables are set
189
+ if ( ! envKey && ! envPassword ) {
190
+ console . error ( '❌ Signing key environment variables not set' ) ;
191
+ console . log ( '\n🔧 To set the signing key:' ) ;
192
+ console . log ( 'export TAURI_SIGNING_PRIVATE_KEY=$(cat ~/.tauri/milo.key)' ) ;
193
+ console . log ( 'export TAURI_SIGNING_PRIVATE_KEY_PASSWORD="test123"' ) ;
194
+ console . log ( '\nOr run this one-liner:' ) ;
195
+ console . log ( 'export TAURI_SIGNING_PRIVATE_KEY=$(cat ~/.tauri/milo.key) && export TAURI_SIGNING_PRIVATE_KEY_PASSWORD="test123"' ) ;
196
+ process . exit ( 1 ) ;
197
+ }
198
+
199
+ if ( ! envKey ) {
200
+ console . error ( '❌ TAURI_SIGNING_PRIVATE_KEY not set' ) ;
201
+ console . log ( 'Run: export TAURI_SIGNING_PRIVATE_KEY=$(cat ~/.tauri/milo.key)' ) ;
202
+ process . exit ( 1 ) ;
203
+ }
204
+
205
+ if ( ! envPassword ) {
206
+ console . error ( '❌ TAURI_SIGNING_PRIVATE_KEY_PASSWORD not set' ) ;
207
+ console . log ( 'Run: export TAURI_SIGNING_PRIVATE_KEY_PASSWORD="test123"' ) ;
208
+ process . exit ( 1 ) ;
209
+ }
210
+
211
+ console . log ( '✅ Signing key setup verified' ) ;
212
+ }
213
+
181
214
function main ( ) {
182
215
const args = process . argv . slice ( 2 ) ;
183
216
let targetVersion = args [ 0 ] ;
@@ -186,7 +219,7 @@ function main() {
186
219
const currentVersion = getCurrentVersion ( ) ;
187
220
console . log ( `Current version: ${ currentVersion } ` ) ;
188
221
console . log ( 'Please provide a target version:' ) ;
189
- console . log ( 'Usage: node scripts/update-latest.js v0.1.9' ) ;
222
+ console . log ( 'Usage: node scripts/update-latest.cjs v0.1.9' ) ;
190
223
process . exit ( 1 ) ;
191
224
}
192
225
@@ -195,6 +228,9 @@ function main() {
195
228
196
229
console . log ( `🚀 Starting release process for v${ targetVersion } ` ) ;
197
230
231
+ // Check signing key setup first
232
+ checkSigningKey ( ) ;
233
+
198
234
// Step 1: Update version files
199
235
updateVersionFiles ( targetVersion ) ;
200
236
0 commit comments