Maybe this will work?
This commit is contained in:
@@ -1,5 +1,19 @@
|
||||
import { fetch } from 'undici'
|
||||
import packageJSON from '../package.json' with { type: 'json' }
|
||||
|
||||
const latestRelease = await (await fetch('https://api.github.com/repos/MarmadileManteater/FreetubeAndroid/releases?per_page=1')).text()
|
||||
console.log(latestRelease)
|
||||
const latestRelease = JSON.parse(await (await fetch('https://api.github.com/repos/MarmadileManteater/FreetubeAndroid/releases?per_page=1')).text())
|
||||
|
||||
const code = latestRelease[0].name
|
||||
|
||||
const [_, latestMajor, latestMinor, latestBuild] = code.split('.')
|
||||
|
||||
const [__, major, minor] = packageJSON.version.split('.')
|
||||
|
||||
if (
|
||||
latestMajor == major &&
|
||||
latestMinor
|
||||
) {
|
||||
console.log(parseInt(latestBuild) + 1)
|
||||
} else {
|
||||
console.log(1)
|
||||
}
|
||||
Reference in New Issue
Block a user