Simplify element builder workflow (#898)

This commit is contained in:
Michael Telatynski 2023-05-15 09:40:39 +01:00 committed by GitHub
parent cb29a10c5e
commit c7c063f129
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 49 additions and 74 deletions

View file

@ -118,15 +118,6 @@ jobs:
echo "config-args=--deb-changelog changelog.Debian" >> $GITHUB_OUTPUT
fi
cat "$DIR/control.template" | grep -v "Architecture: " > debcontrol
echo "Architecture: $ARCHITECTURE" >> debcontrol
VERSION=${INPUT_VERSION:-$(cat package.json | jq -r .version)}
echo "Version: $VERSION" >> debcontrol
env:
DIR: ${{ inputs.config }}
INPUT_VERSION: ${{ inputs.version }}
ARCHITECTURE: ${{ inputs.arch }}
- name: Build App
run: |
npx ts-node scripts/generate-builder-config.ts \

View file

@ -1,12 +0,0 @@
Package: element-nightly
License: Apache-2.0
Vendor: support@element.io
Architecture: amd64
Maintainer: support@element.io
Depends: libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, xdg-utils, libatspi2.0-0, libuuid1, libsecret-1-0, libasound2, libgbm1
Recommends: libsqlcipher0, element-io-archive-keyring
Section: net
Priority: extra
Homepage: https://element.io/
Description:
riot.im A feature-rich client for Matrix.org (nightly unstable build).

View file

@ -1,9 +0,0 @@
Package: riot-nightly
Version: 2020071502
Depends: element-nightly
Maintainer: packages@element.io
Architecture: all
Priority: optional
Section: oldlibs
Description: transitional package
This is a transitional package. It can safely be removed.

View file

@ -1,14 +0,0 @@
Package: element-desktop
License: Apache-2.0
Vendor: support@element.io
Architecture: amd64
Maintainer: support@element.io
Depends: libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, xdg-utils, libatspi2.0-0, libuuid1, libsecret-1-0, libasound2, libgbm1
Recommends: libsqlcipher0, element-io-archive-keyring
Replaces: riot-desktop (<< 1.7.0), riot-web (<< 1.7.0)
Breaks: riot-desktop (<< 1.7.0), riot-web (<< 1.7.0)
Section: net
Priority: extra
Homepage: https://element.io/
Description:
A feature-rich client for Matrix.org

View file

@ -1,9 +0,0 @@
Package: riot-desktop
Version: 1.7.0
Depends: element-desktop
Maintainer: packages@element.io
Architecture: all
Priority: optional
Section: oldlibs
Description: transitional package
This is a transitional package. It can safely be removed.

View file

@ -5,6 +5,7 @@
"version": "1.11.31",
"description": "A feature-rich client for Matrix.org",
"author": "Element",
"homepage": "https://element.io",
"repository": {
"type": "git",
"url": "https://github.com/vector-im/element-desktop"
@ -145,17 +146,45 @@
"deb"
],
"category": "Network;InstantMessaging;Chat",
"maintainer": "support@element.io"
"maintainer": "support@element.io",
"icon": "build/icons"
},
"deb": {
"packageCategory": "net",
"depends": [
"libgtk-3-0",
"libnotify4",
"libnss3",
"libxss1",
"libxtst6",
"xdg-utils",
"libatspi2.0-0",
"libuuid1",
"libsecret-1-0",
"libasound2",
"libgbm1"
],
"recommends": [
"libsqlcipher0",
"element-io-archive-keyring"
]
},
"mac": {
"category": "public.app-category.social-networking",
"darkModeSupport": true,
"gatekeeperAssess": true
"hardenedRuntime": true,
"gatekeeperAssess": true,
"entitlements": "./build/entitlements.mac.plist",
"icon": "build/icons/icon.icns"
},
"win": {
"target": [
"squirrel"
]
],
"signingHashAlgorithms": [
"sha256"
],
"icon": "build/icons/icon.ico"
},
"directories": {
"output": "dist"

View file

@ -13,6 +13,7 @@
* On Linux:
* Replaces spaces in the product name with dashes as spaces in paths can cause issues
* Passes --deb-custom-control to build.deb.fpm if specified
* Removes libsqlcipher0 recommended dependency if env SQLCIPHER_BUNDLED is asserted.
*/
import parseArgs from "minimist";
@ -30,17 +31,9 @@ const argv = parseArgs<{
"signtool-thumbprint"?: string;
"signtool-subject-name"?: string;
"notarytool-team-id"?: string;
"deb-custom-control"?: string;
"deb-changelog"?: string;
}>(process.argv.slice(2), {
string: [
"nightly",
"deb-custom-control",
"deb-changelog",
"signtool-thumbprint",
"signtool-subject-name",
"notarytool-team-id",
],
string: ["nightly", "deb-changelog", "signtool-thumbprint", "signtool-subject-name", "notarytool-team-id"],
});
type DeepWriteable<T> = { -readonly [P in keyof T]: DeepWriteable<T[P]> };
@ -50,12 +43,14 @@ interface PackageBuild extends DeepWriteable<Omit<Configuration, "extraMetadata"
productName?: string;
name?: string;
version?: string;
description?: string;
};
}
interface Package {
build: PackageBuild;
productName: string;
description: string;
}
async function main(): Promise<number | void> {
@ -66,6 +61,7 @@ async function main(): Promise<number | void> {
...pkg.build,
extraMetadata: {
productName: pkg.productName,
description: pkg.description,
},
};
@ -73,6 +69,7 @@ async function main(): Promise<number | void> {
cfg.appId = NIGHTLY_APP_ID;
cfg.extraMetadata!.productName += " Nightly";
cfg.extraMetadata!.name = NIGHTLY_APP_NAME;
cfg.extraMetadata!.description += " (nightly unstable build)";
let version = argv.nightly;
if (os.platform() === "win32") {
@ -84,10 +81,13 @@ async function main(): Promise<number | void> {
version = "0.0.1-nightly." + version;
}
cfg.extraMetadata!.version = version;
} else {
if (!cfg.deb!.fpm) cfg.deb!.fpm = [];
cfg.deb!.fpm!.push("--deb-field", "Replaces: riot-desktop (<< 1.7.0), riot-web (<< 1.7.0)");
cfg.deb!.fpm!.push("--deb-field", "Breaks: riot-desktop (<< 1.7.0), riot-web (<< 1.7.0)");
}
if (argv["signtool-thumbprint"] && argv["signtool-subject-name"]) {
cfg.win!.signingHashAlgorithms = ["sha256"];
cfg.win!.certificateSubjectName = argv["signtool-subject-name"];
cfg.win!.certificateSha1 = argv["signtool-thumbprint"];
}
@ -103,15 +103,14 @@ 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!.push(`--deb-custom-control=${argv["deb-custom-control"]}`);
}
if (argv["deb-changelog"]) {
cfg.deb.fpm!.push(`--deb-changelog=${argv["deb-changelog"]}`);
if (!cfg.deb!.fpm) cfg.deb!.fpm = [];
cfg.deb!.fpm!.push(`--deb-changelog=${argv["deb-changelog"]}`);
}
if (process.env.SQLCIPHER_BUNDLED) {
// Remove sqlcipher dependency when using bundled
cfg.deb!.recommends = cfg.deb!.recommends?.filter((d) => d !== "libsqlcipher0");
}
}