Support for alpha build channel
This commit is contained in:
parent
c0ab1dff11
commit
7ce89414bf
15 changed files with 337 additions and 27 deletions
|
@ -2,6 +2,37 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import * as semver from 'semver';
|
||||
import moment from 'moment';
|
||||
|
||||
export const isProduction = (version: string): boolean => {
|
||||
const parsed = semver.parse(version);
|
||||
|
||||
if (!parsed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !parsed.prerelease.length && !parsed.build.length;
|
||||
};
|
||||
|
||||
export const isBeta = (version: string): boolean =>
|
||||
semver.parse(version)?.prerelease[0] === 'beta';
|
||||
|
||||
export const isAlpha = (version: string): boolean =>
|
||||
semver.parse(version)?.prerelease[0] === 'alpha';
|
||||
|
||||
export const generateAlphaVersion = (options: {
|
||||
currentVersion: string;
|
||||
shortSha: string;
|
||||
}): string => {
|
||||
const { currentVersion, shortSha } = options;
|
||||
|
||||
const parsed = semver.parse(currentVersion);
|
||||
if (!parsed) {
|
||||
throw new Error(`generateAlphaVersion: Invalid version ${currentVersion}`);
|
||||
}
|
||||
|
||||
const formattedDate = moment().utc().format('YYYYMMDD.HH');
|
||||
const formattedVersion = `${parsed.major}.${parsed.minor}.${parsed.patch}`;
|
||||
|
||||
return `${formattedVersion}-alpha.${formattedDate}-${shortSha}`;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue