web: Seal version data in the extension manifest, too.
This commit is contained in:
parent
15c7b6520b
commit
6ad6912309
|
@ -319,6 +319,7 @@ jobs:
|
||||||
shell: bash -l {0}
|
shell: bash -l {0}
|
||||||
working-directory: web
|
working-directory: web
|
||||||
env:
|
env:
|
||||||
|
BUILD_ID: ${{ github.run_number }}
|
||||||
ENABLE_VERSION_SEAL: "true"
|
ENABLE_VERSION_SEAL: "true"
|
||||||
run: node packages/core/tools/set_version.js
|
run: node packages/core/tools/set_version.js
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ if (process.env.ENABLE_VERSION_SEAL === "true") {
|
||||||
version_channel: version_channel,
|
version_channel: version_channel,
|
||||||
build_date: build_date,
|
build_date: build_date,
|
||||||
commitHash: commitHash,
|
commitHash: commitHash,
|
||||||
|
build_id: process.env.BUILD_ID,
|
||||||
};
|
};
|
||||||
|
|
||||||
fs.writeFileSync("version_seal.json", JSON.stringify(version_seal));
|
fs.writeFileSync("version_seal.json", JSON.stringify(version_seal));
|
||||||
|
|
|
@ -3,20 +3,42 @@
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const json5 = require("json5");
|
const json5 = require("json5");
|
||||||
const CopyPlugin = require("copy-webpack-plugin");
|
const CopyPlugin = require("copy-webpack-plugin");
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
function transformManifest(content, env) {
|
function transformManifest(content, env) {
|
||||||
const manifest = json5.parse(content);
|
const manifest = json5.parse(content);
|
||||||
|
|
||||||
const packageVersion = process.env.npm_package_version;
|
let packageVersion = process.env.npm_package_version;
|
||||||
|
let versionChannel = process.env.CFG_RELEASE_CHANNEL || "nightly";
|
||||||
|
let buildDate = new Date().toISOString().substring(0, 10);
|
||||||
|
let build_id = process.env.BUILD_ID;
|
||||||
|
|
||||||
const versionChannel = process.env.CFG_RELEASE_CHANNEL || "nightly";
|
if (process.env.ENABLE_VERSION_SEAL === "true") {
|
||||||
|
if (fs.existsSync("../../version_seal.json")) {
|
||||||
|
const version_seal = JSON.parse(
|
||||||
|
fs.readFileSync("../../version_seal.json")
|
||||||
|
);
|
||||||
|
|
||||||
const buildDate = new Date().toISOString().substring(0, 10);
|
packageVersion = version_seal.version_number;
|
||||||
|
versionChannel = version_seal.version_channel;
|
||||||
|
buildDate = version_seal.build_date.substring(0, 10);
|
||||||
|
build_id = version_seal.build_id;
|
||||||
|
} else {
|
||||||
|
throw new Error(
|
||||||
|
"Version seal requested but not found. Please run web/packages/core/tools/set_version.js with ENABLE_VERSION_SEAL to generate it."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point all code below needs to be deterministic. If you want other
|
||||||
|
// information to be included here you must store it in the version seal
|
||||||
|
// when it gets generated in web/packages/core/tools/set_version.js and then
|
||||||
|
// load it in the code above.
|
||||||
|
|
||||||
// The extension marketplaces require the version to monotonically increase,
|
// The extension marketplaces require the version to monotonically increase,
|
||||||
// so append the build number onto the end of the manifest version.
|
// so append the build number onto the end of the manifest version.
|
||||||
manifest.version = process.env.BUILD_ID
|
manifest.version = build_id
|
||||||
? `${packageVersion}.${process.env.BUILD_ID}`
|
? `${packageVersion}.${build_id}`
|
||||||
: packageVersion;
|
: packageVersion;
|
||||||
|
|
||||||
if (env.firefox) {
|
if (env.firefox) {
|
||||||
|
|
Loading…
Reference in New Issue