mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-20 02:08:57 +00:00
Add script for linux build targets
This commit is contained in:
@@ -45,6 +45,7 @@
|
|||||||
"prepare-adhoc-build": "node scripts/prepare_adhoc_build.js",
|
"prepare-adhoc-build": "node scripts/prepare_adhoc_build.js",
|
||||||
"prepare-adhoc-version": "node scripts/prepare_tagged_version.js adhoc",
|
"prepare-adhoc-version": "node scripts/prepare_tagged_version.js adhoc",
|
||||||
"prepare-staging-build": "node scripts/prepare_staging_build.js",
|
"prepare-staging-build": "node scripts/prepare_staging_build.js",
|
||||||
|
"prepare-linux-build": "node scripts/prepare_linux_build.js",
|
||||||
"test": "run-s test-node test-electron test-lint-intl test-eslint",
|
"test": "run-s test-node test-electron test-lint-intl test-eslint",
|
||||||
"test-electron": "node ts/scripts/test-electron.js",
|
"test-electron": "node ts/scripts/test-electron.js",
|
||||||
"test-release": "node ts/scripts/test-release.js",
|
"test-release": "node ts/scripts/test-release.js",
|
||||||
|
|||||||
@@ -3,7 +3,15 @@
|
|||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
# ./build.sh [ dev (default) | public (prod and beta builds) | alpha | test | staging ] [ Build timestamp override. Defaults to latest git commit or 1. ]
|
# ./build.sh [ dev (default) | public (prod and beta builds) | alpha | test | staging ]
|
||||||
|
# Env vars:
|
||||||
|
# SOURCE_DATE_EPOCH: Build timestamp override. Defaults to latest git commit or 1.
|
||||||
|
# SKIP_DOCKER_BUILD: To support docker build cache during actions.
|
||||||
|
# BUILD_TARGETS: Override build targets. Empty default results in deb.
|
||||||
|
|
||||||
|
# Examples:
|
||||||
|
# ./build.sh public
|
||||||
|
# SOURCE_DATE_EPOCH=123 ./build.sh test
|
||||||
|
|
||||||
# First we prepare the docker container in which our build scripts will run. This container includes
|
# First we prepare the docker container in which our build scripts will run. This container includes
|
||||||
# all build dependencies at specific versions.
|
# all build dependencies at specific versions.
|
||||||
@@ -19,9 +27,9 @@ cd ..
|
|||||||
|
|
||||||
# Prepare the timestamp of the actual build based on the latest git commit.
|
# Prepare the timestamp of the actual build based on the latest git commit.
|
||||||
source_date_epoch=1
|
source_date_epoch=1
|
||||||
if [ "$2" != "" ]; then
|
if [ -n "${SOURCE_DATE_EPOCH}" ]; then
|
||||||
echo "Using override timestamp for SOURCE_DATE_EPOCH."
|
echo "Using override timestamp for SOURCE_DATE_EPOCH."
|
||||||
source_date_epoch=$(($2))
|
source_date_epoch="${SOURCE_DATE_EPOCH}"
|
||||||
else
|
else
|
||||||
git_timestamp=$(git log -1 --pretty=%ct)
|
git_timestamp=$(git log -1 --pretty=%ct)
|
||||||
if [ "${git_timestamp}" != "" ]; then
|
if [ "${git_timestamp}" != "" ]; then
|
||||||
@@ -45,4 +53,5 @@ docker run --rm \
|
|||||||
-e NPM_CONFIG_CACHE=/tmp/.npm-cache \
|
-e NPM_CONFIG_CACHE=/tmp/.npm-cache \
|
||||||
-e PNPM_HOME=/tmp/.pnpm-home \
|
-e PNPM_HOME=/tmp/.pnpm-home \
|
||||||
-e SOURCE_DATE_EPOCH=$source_date_epoch \
|
-e SOURCE_DATE_EPOCH=$source_date_epoch \
|
||||||
|
-e BUILD_TARGETS=$BUILD_TARGETS \
|
||||||
signal-desktop $1
|
signal-desktop $1
|
||||||
|
|||||||
@@ -66,4 +66,8 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${BUILD_TARGETS}" != "" ]; then
|
||||||
|
pnpm run prepare-linux-build $BUILD_TARGETS
|
||||||
|
fi
|
||||||
|
|
||||||
pnpm run build-linux
|
pnpm run build-linux
|
||||||
|
|||||||
30
scripts/prepare_linux_build.js
Normal file
30
scripts/prepare_linux_build.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
// Copyright 2025 Signal Messenger, LLC
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
const fs = require('node:fs');
|
||||||
|
const _ = require('lodash');
|
||||||
|
|
||||||
|
const TARGETS = new Set(['appimage', 'deb']);
|
||||||
|
|
||||||
|
const targets = (process.argv[2] || '').split(',');
|
||||||
|
if (
|
||||||
|
targets.length === 0 ||
|
||||||
|
!targets.every(target => TARGETS.has(target.toLowerCase()))
|
||||||
|
) {
|
||||||
|
console.error(
|
||||||
|
`Invalid linux targets ${targets}. Valid options: ${[...TARGETS]}`
|
||||||
|
);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { default: packageJson } = require('./packageJson.js');
|
||||||
|
|
||||||
|
console.log('prepare_linux_build: updating package.json');
|
||||||
|
|
||||||
|
// ------
|
||||||
|
|
||||||
|
_.set(packageJson, 'build.linux.target', targets);
|
||||||
|
|
||||||
|
// -------
|
||||||
|
|
||||||
|
fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, ' '));
|
||||||
Reference in New Issue
Block a user