Include changelogs in deb package (#563)

* Initial attempt at custom Debian changelogs

* Iterate

* Quotes...

* Iterate

* facepalm

* Iterate

* Remove reundant line

* Ifs

* Test

* Iterate

* Iterate

* Brackets

* inconsistent?

* Update build_and_test.yaml

* Update build_and_test.yaml
This commit is contained in:
Michael Telatynski
2023-03-07 15:53:53 +00:00
committed by GitHub
parent 25af58e86f
commit 22fe702b83
6 changed files with 90 additions and 159 deletions

View File

@@ -15,6 +15,7 @@
import parseArgs from "minimist";
import fsProm from "fs/promises";
import * as os from "os";
import { Configuration } from "app-builder-lib";
const ELECTRON_BUILDER_CFG_FILE = "electron-builder.json";
@@ -26,53 +27,14 @@ const argv = parseArgs<{
"signtool-thumbprint"?: string;
"signtool-subject-name"?: string;
"deb-custom-control"?: string;
"deb-changelog"?: string;
}>(process.argv.slice(2), {
string: ["nightly", "deb-custom-control", "signtool-thumbprint", "signtool-subject-name"],
string: ["nightly", "deb-custom-control", "deb-changelog", "signtool-thumbprint", "signtool-subject-name"],
});
interface File {
from: string;
to: string;
}
type DeepWriteable<T> = { -readonly [P in keyof T]: DeepWriteable<T[P]> };
interface PackageBuild {
appId: string;
asarUnpack: string;
files: Array<string | File>;
extraResources: Array<string | File>;
linux: {
target: string;
category: string;
maintainer: string;
desktop: {
StartupWMClass: string;
};
};
mac: {
category: string;
darkModeSupport: boolean;
};
win: {
target: {
target: string;
};
sign?: string;
signingHashAlgorithms?: string[];
certificateSubjectName?: string;
certificateSha1?: string;
};
deb?: {
fpm?: string[];
};
directories: {
output: string;
};
afterPack: string;
afterSign: string;
protocols: Array<{
name: string;
schemes: string[];
}>;
interface PackageBuild extends DeepWriteable<Omit<Configuration, "extraMetadata">> {
extraMetadata?: {
productName?: string;
name?: string;
@@ -114,10 +76,10 @@ async function main(): Promise<number | void> {
}
if (argv["signtool-thumbprint"] && argv["signtool-subject-name"]) {
delete cfg.win.sign;
cfg.win.signingHashAlgorithms = ["sha256"];
cfg.win.certificateSubjectName = argv["signtool-subject-name"];
cfg.win.certificateSha1 = argv["signtool-thumbprint"];
delete cfg.win!.sign;
cfg.win!.signingHashAlgorithms = ["sha256"];
cfg.win!.certificateSubjectName = argv["signtool-subject-name"];
cfg.win!.certificateSha1 = argv["signtool-thumbprint"];
}
if (os.platform() === "linux") {
@@ -125,10 +87,15 @@ async function main(): Promise<number | void> {
// https://github.com/vector-im/element-web/issues/13171
cfg.extraMetadata!.productName = cfg.extraMetadata!.productName!.replace(/ /g, "-");
cfg.deb = {
fpm: [],
};
if (argv["deb-custom-control"]) {
cfg.deb = {
fpm: [`--deb-custom-control=${argv["deb-custom-control"]}`],
};
cfg.deb.fpm!.push(`--deb-custom-control=${argv["deb-custom-control"]}`);
}
if (argv["deb-changelog"]) {
cfg.deb.fpm!.push(`--deb-changelog=${argv["deb-changelog"]}`);
}
}