@@ -22,6 +22,14 @@ const electronBridgeScript = path.join(
2222 'scripts' ,
2323 'create-electron-bridge-manifest.mjs' ,
2424) ;
25+ const desktopUpdateScript = path . join (
26+ packageDir ,
27+ '..' ,
28+ '..' ,
29+ '.github' ,
30+ 'scripts' ,
31+ 'create-desktop-update-manifest.mjs' ,
32+ ) ;
2533const root = fs . mkdtempSync (
2634 path . join ( os . tmpdir ( ) , 'openwork-desktop-release-test-' ) ,
2735) ;
3240 testMacosPermissions ( ) ;
3341 testReleaseWorkflow ( ) ;
3442 testRuntimePreparationContract ( ) ;
43+ testDesktopUpdateManifest ( path . join ( root , 'desktop-update' ) ) ;
3544 testElectronBridgeManifest ( path . join ( root , 'electron-bridge' ) ) ;
3645 testChecksumRefresh ( path . join ( root , 'checksums' ) ) ;
3746 testVersionSynchronization ( path . join ( root , 'version' ) ) ;
@@ -258,10 +267,54 @@ function testReleaseWorkflow() {
258267 / i f : ' ? i n p u t s \. d r y _ r u n = = f a l s e ' ? [ \s \S ] * c o n t e n t s : ' ? w r i t e ' ? / ,
259268 ) ;
260269 assert . match ( publishJob , / s e c r e t s : ' ? i n h e r i t ' ? / ) ;
270+ const matrices = buildWorkflow . match (
271+ / f r o m J S O N \( i n p u t s \. p u b l i s h & & \s * ' ( [ ^ ' ] + ) ' \| \| \s * ' ( [ ^ ' ] + ) ' \) / ,
272+ ) ;
273+ assert . ok ( matrices ) ;
274+ assert . equal (
275+ JSON . parse ( matrices [ 1 ] ) . some ( ( { os } ) => os . startsWith ( 'windows-' ) ) ,
276+ false ,
277+ ) ;
278+ assert . equal (
279+ JSON . parse ( matrices [ 2 ] ) . some ( ( { os } ) => os . startsWith ( 'windows-' ) ) ,
280+ true ,
281+ ) ;
261282 assert . doesNotMatch ( workflow , / u s e s : [ ^ \n ] + @ ( v \d | s t a b l e ) \b / ) ;
262283 assert . doesNotMatch ( workflow , / p u s h - - f o r c e | f o r c e - w i t h - l e a s e / ) ;
263284}
264285
286+ function testDesktopUpdateManifest ( directory ) {
287+ const assets = path . join ( directory , 'assets' ) ;
288+ const output = path . join ( directory , 'latest.json' ) ;
289+ fs . mkdirSync ( assets , { recursive : true } ) ;
290+ for ( const artifact of [
291+ 'OpenWork-aarch64-apple-darwin.app.tar.gz' ,
292+ 'OpenWork-x86_64-apple-darwin.app.tar.gz' ,
293+ 'OpenWork_0.2.1_amd64.AppImage' ,
294+ ] ) {
295+ fs . writeFileSync ( path . join ( assets , artifact ) , artifact ) ;
296+ fs . writeFileSync ( path . join ( assets , `${ artifact } .sig` ) , `signature:${ artifact } ` ) ;
297+ }
298+ execFileSync ( process . execPath , [
299+ desktopUpdateScript ,
300+ '--assets' ,
301+ assets ,
302+ '--repository' ,
303+ 'modelstudioai/openwork' ,
304+ '--tag' ,
305+ 'openwork-v0.2.1' ,
306+ '--version' ,
307+ '0.2.1' ,
308+ '--output' ,
309+ output ,
310+ ] ) ;
311+ assert . deepEqual ( Object . keys ( JSON . parse ( fs . readFileSync ( output ) ) . platforms ) , [
312+ 'darwin-aarch64' ,
313+ 'darwin-x86_64' ,
314+ 'linux-x86_64' ,
315+ ] ) ;
316+ }
317+
265318function testElectronBridgeManifest ( directory ) {
266319 const assets = path . join ( directory , 'assets' ) ;
267320 fs . mkdirSync ( assets , { recursive : true } ) ;
0 commit comments