ci: add beta release channel

This commit is contained in:
Johannes Loher 2023-07-09 23:05:17 +02:00
parent 4646491fd4
commit 2e17ba2085
No known key found for this signature in database
GPG key ID: 7CB0A9FB553DA045
2 changed files with 33 additions and 6 deletions

View file

@ -13,7 +13,8 @@ const repositoryName = process.env.CI_REPO_NAME;
const repositoryURL = process.env.CI_REPO_LINK;
const forgeURL = process.env.CI_FORGE_URL;
const manifestURL = `${forgeURL}/api/packages/${repositoryOwner}/generic/${repositoryName}/latest/${packageType}.json`;
const getManifestUrl = (channel) =>
`${forgeURL}/api/packages/${repositoryOwner}/generic/${repositoryName}/${channel}/${packageType}.json`;
const getDownloadURL = (version) => `${repositoryURL}/releases/download/${version}/${repositoryName}.zip`;
const bugsURL = `${repositoryURL}/issues`;
const getChangelogURL = (version) => `${repositoryURL}/releases/tag/${version}`;
@ -46,6 +47,15 @@ function getTargetVersion(currentVersion, release) {
}
}
/**
* Get the channel for a given version.
* @param {string} version The version for which to get the channel
* @returns {"latest" | "beta"} The channel for the version
*/
function getChannel(version) {
return version.includes("-") ? "beta" : "latest";
}
/**
* Update version and download URL.
* @param {semver.ReleaseType | string} release Either a semver release type or a valid semver version
@ -74,7 +84,7 @@ function bumpVersion(release) {
fs.writeJSONSync("package.json", packageJson, { spaces: 4 });
manifest.version = targetVersion;
manifest.url = repositoryURL;
manifest.manifest = manifestURL;
manifest.manifest = getManifestUrl(getChannel(targetVersion));
manifest.download = getDownloadURL(targetVersion);
manifest.bugs = bugsURL;
manifest.changelog = getChangelogURL(targetVersion);