mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-21 16:18:28 +01:00
Fix Beta Version (#8944)
* Fix Beta Version * Add Comments * Fix Function Reference
This commit is contained in:
parent
bb0a65f6d6
commit
443da7f62d
@ -30,6 +30,19 @@ const filters = {
|
|||||||
safari: ["!build/safari/**/*"],
|
safari: ["!build/safari/**/*"],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a number to a tuple containing two Uint16's
|
||||||
|
* @param num {number} This number is expected to be a integer style number with no decimals
|
||||||
|
*
|
||||||
|
* @returns {number[]} A tuple containing two elements that are both numbers.
|
||||||
|
*/
|
||||||
|
function numToUint16s(num) {
|
||||||
|
var arr = new ArrayBuffer(4);
|
||||||
|
var view = new DataView(arr);
|
||||||
|
view.setUint32(0, num, false);
|
||||||
|
return [view.getUint16(0), view.getUint16(2)];
|
||||||
|
}
|
||||||
|
|
||||||
function buildString() {
|
function buildString() {
|
||||||
var build = "";
|
var build = "";
|
||||||
if (process.env.MANIFEST_VERSION) {
|
if (process.env.MANIFEST_VERSION) {
|
||||||
@ -258,8 +271,19 @@ function applyBetaLabels(manifest) {
|
|||||||
manifest.short_name = "Bitwarden BETA";
|
manifest.short_name = "Bitwarden BETA";
|
||||||
manifest.description = "THIS EXTENSION IS FOR BETA TESTING BITWARDEN.";
|
manifest.description = "THIS EXTENSION IS FOR BETA TESTING BITWARDEN.";
|
||||||
if (process.env.GITHUB_RUN_ID) {
|
if (process.env.GITHUB_RUN_ID) {
|
||||||
manifest.version_name = `${manifest.version} beta - ${process.env.GITHUB_SHA.slice(0, 8)}`;
|
const existingVersionParts = manifest.version.split("."); // 3 parts expected 2024.4.0
|
||||||
manifest.version = `${manifest.version}.${parseInt(process.env.GITHUB_RUN_ID.slice(-4))}`;
|
|
||||||
|
// GITHUB_RUN_ID is a number like: 8853654662
|
||||||
|
// which will convert to [ 4024, 3206 ]
|
||||||
|
// and a single incremented id of 8853654663 will become [ 4024, 3207 ]
|
||||||
|
const runIdParts = numToUint16s(parseInt(process.env.GITHUB_RUN_ID));
|
||||||
|
|
||||||
|
// Only use the first 2 parts from the given version number and base the other 2 numbers from the GITHUB_RUN_ID
|
||||||
|
// Example: 2024.4.4024.3206
|
||||||
|
const betaVersion = `${existingVersionParts[0]}.${existingVersionParts[1]}.${runIdParts[0]}.${runIdParts[1]}`;
|
||||||
|
|
||||||
|
manifest.version_name = `${betaVersion} beta - ${process.env.GITHUB_SHA.slice(0, 8)}`;
|
||||||
|
manifest.version = betaVersion;
|
||||||
} else {
|
} else {
|
||||||
manifest.version = `${manifest.version}.0`;
|
manifest.version = `${manifest.version}.0`;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user