@@ -16,6 +16,7 @@ declare global {
16
16
17
17
const dirname = path . dirname ( fileURLToPath ( import . meta. url ) )
18
18
const envPath = path . join ( dirname , '..' , '..' , '.env' )
19
+ const tauriConfPath = path . join ( dirname , '..' , '..' , 'src-tauri' , 'tauri.conf.json' )
19
20
const packageJsonPath = path . join ( dirname , '..' , '..' , 'package.json' )
20
21
const token = process . env . GITHUB_TOKEN
21
22
const secret = process . env . CLIENT_SECRET
@@ -27,10 +28,17 @@ VITE_CLIENT_ID=${id}
27
28
`
28
29
29
30
async function run ( ) {
31
+ const tauriConf = JSON . parse (
32
+ await fs . readFile ( tauriConfPath , 'utf-8' ) ,
33
+ ) as typeof import ( '../../src-tauri/tauri.conf.json' )
34
+
30
35
const packageJSON = JSON . parse (
31
36
await fs . readFile ( packageJsonPath , 'utf-8' ) ,
32
37
) as typeof import ( '../../package.json' )
33
38
39
+ if ( packageJSON . version !== tauriConf . package . version )
40
+ throw new Error ( 'Tauri config and Package JSON versions are not the same, update both of them!' )
41
+
34
42
const dmgFileName = `Gitification_${ packageJSON . version } _universal.dmg`
35
43
36
44
const dmgPath = path . join (
@@ -48,6 +56,19 @@ async function run() {
48
56
49
57
const octokit = github . getOctokit ( token )
50
58
59
+ try {
60
+ const remoteRelease = await octokit . rest . repos . getLatestRelease ( {
61
+ owner : 'Gitification-App' ,
62
+ repo : 'gitification' ,
63
+ } )
64
+
65
+ if ( remoteRelease . data . name === packageJSON . version . toString ( ) ) {
66
+ console . log ( 'No version change detected, skipping build.' )
67
+ return
68
+ }
69
+ }
70
+ catch { /* If endpoint throws, it means no release yet */ }
71
+
51
72
await fs . writeFile ( envPath , envFileContent , 'utf-8' )
52
73
await execaCommand ( 'pnpm tauri build --target universal-apple-darwin' , { stdio : 'inherit' } )
53
74
0 commit comments