-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
613d1ce
commit 07cfd71
Showing
2 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import fetch from 'node-fetch'; | ||
import fs from 'fs'; | ||
|
||
// Fetch version value fromy yaml file https://raw.githubusercontent.com/LinwoodDev/Qeck/nightly/app/pubspec.yaml | ||
const nightlyUrl = 'https://raw.githubusercontent.com/LinwoodDev/Qeck/nightly/app/pubspec.yaml'; | ||
const nightlyVersion = await fetch(nightlyUrl).then(res => res.text()).then(text => { | ||
const regex = /^version:\s(.+)\+(.+)$/gm; | ||
const match = regex.exec(text); | ||
return match[1]; | ||
} | ||
); | ||
|
||
// stable | ||
const stableUrl = 'https://raw.githubusercontent.com/LinwoodDev/Qeck/stable/app/pubspec.yaml'; | ||
const stableVersion = await fetch(stableUrl).then(res => res.text()).then(text => { | ||
const regex = /^version:\s(.+)\+(.+)$/gm; | ||
const match = regex.exec(text); | ||
return match[1]; | ||
} | ||
); | ||
|
||
// develop | ||
const developUrl = 'https://raw.githubusercontent.com/LinwoodDev/Qeck/develop/app/pubspec.yaml'; | ||
const developVersion = await fetch(developUrl).then(res => res.text()).then(text => { | ||
const regex = /^version:\s(.+)\+(.+)$/gm; | ||
const match = regex.exec(text); | ||
return match[1]; | ||
} | ||
); | ||
|
||
// main | ||
const mainUrl = 'https://raw.githubusercontent.com/LinwoodDev/Qeck/main/app/pubspec.yaml'; | ||
const mainVersion = await fetch(mainUrl).then(res => res.text()).then(text => { | ||
const regex = /^version:\s(.+)\+(.+)$/gm; | ||
const match = regex.exec(text); | ||
return match[1]; | ||
} | ||
); | ||
|
||
// Write nightly and stable version to meta.json | ||
const meta = { | ||
version: { | ||
nightly: nightlyVersion, | ||
stable: stableVersion, | ||
develop: developVersion, | ||
main: mainVersion, | ||
} | ||
}; | ||
|
||
// Write to static/meta.json | ||
const metaPath = 'static/meta.json'; | ||
// Create meta.json if it doesn't exist | ||
if (!fs.existsSync(metaPath)) { | ||
fs.writeFileSync(metaPath, JSON.stringify(meta)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters