Skip to content

Commit dc277f0

Browse files
committed
Fix version workflow action
1 parent f1ca3ca commit dc277f0

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

.github/actions/release.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,6 @@ async function run() {
4848

4949
const octokit = github.getOctokit(token)
5050

51-
try {
52-
const remoteRelease = await octokit.rest.repos.getLatestRelease({
53-
owner: 'Gitification-App',
54-
repo: 'gitification',
55-
})
56-
57-
if (remoteRelease.data.name === packageJSON.version.toString()) {
58-
console.log('No version change detected, skipping build.')
59-
return
60-
}
61-
}
62-
catch { /* If endpoint throws, it means no release yet */ }
63-
6451
await fs.writeFile(envPath, envFileContent, 'utf-8')
6552
await execaCommand('pnpm tauri build --target universal-apple-darwin', { stdio: 'inherit' })
6653

.github/actions/version.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import path from 'path'
22
import { fileURLToPath } from 'url'
33
import fs from 'fs/promises'
4+
import github from '@actions/github'
45

56
const dirname = path.dirname(fileURLToPath(import.meta.url))
67
const tauriConfPath = path.join(dirname, '..', '..', 'src-tauri', 'tauri.conf.json')
78
const packageJsonPath = path.join(dirname, '..', '..', 'package.json')
9+
const token = process.env.GITHUB_TOKEN
810

911
async function run() {
1012
const tauriConf = JSON.parse(
@@ -17,6 +19,19 @@ async function run() {
1719

1820
if (packageJSON.version !== tauriConf.package.version)
1921
throw new Error('Tauri config and Package JSON versions are not the same, update both of them!')
22+
23+
const octokit = github.getOctokit(token)
24+
25+
try {
26+
const remoteRelease = await octokit.rest.repos.getLatestRelease({
27+
owner: 'Gitification-App',
28+
repo: 'gitification',
29+
})
30+
31+
if (remoteRelease.data.name === packageJSON.version.toString())
32+
console.log('No version change detected, skipping build.')
33+
}
34+
catch { /* If endpoint throws, it means no release yet */ }
2035
}
2136

2237
run()

0 commit comments

Comments
 (0)