1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +01:00

Add alpha version to updates.json during build

This commit is contained in:
kkapsner 2024-02-17 00:07:11 +01:00
parent 7229133c8d
commit 4a2079bf47

View File

@ -21,6 +21,23 @@ function getXPIFileName(id, version){
return `${id}-${version}.xpi`; return `${id}-${version}.xpi`;
} }
async function addAlphaVersionToUpdatesJSON(version){
"use strict";
const updatesPath = path.join(versionsPath, "updates.json");
const data = JSON.parse(await fs.promises.readFile(updatesPath));
const versions = data.addons["CanvasBlocker-Beta@kkapsner.de"].updates;
if (versions.some(function(entry){
return entry.version === version;
})){
return;
}
versions.push({
version,
update_link: `https://canvasblocker.kkapsner.de/versions/${getXPIFileName("canvasblocker_beta", version)}`
});
await fs.promises.writeFile(updatesPath, JSON.stringify(data, undefined, "\t"));
}
async function getAlphaVersion(manifest){ async function getAlphaVersion(manifest){
"use strict"; "use strict";
function f(n){ function f(n){
@ -73,6 +90,7 @@ async function run(){
} }
if (args.type === "alpha"){ if (args.type === "alpha"){
manifest.version = await getAlphaVersion(manifest); manifest.version = await getAlphaVersion(manifest);
addAlphaVersionToUpdatesJSON(manifest.version);
} }
else if (args.type === "rc"){ else if (args.type === "rc"){
manifest.version = getRCVersion(manifest); manifest.version = getRCVersion(manifest);