Ensure file permissions when building for Linux and set sha length for test builds

This commit is contained in:
ayumi-signal
2025-09-30 13:17:29 -07:00
committed by GitHub
parent 8fee01054a
commit 7bb8a35839
4 changed files with 33 additions and 4 deletions

View File

@@ -34,9 +34,6 @@ echo "BUILD_TYPE: ${BUILD_TYPE}"
# UNIX timestamp will be generated at the time of the build, and is non-deterministic.
echo "SOURCE_DATE_EPOCH: ${SOURCE_DATE_EPOCH}"
# Ensure consistent permissions for files copied via electron builder extraResources
umask 0022
pnpm install --frozen-lockfile
pnpm run clean-transpile
cd sticker-creator

View File

@@ -18,7 +18,7 @@ if (release !== 'alpha' && release !== 'axolotl' && release !== 'adhoc') {
const { generateTaggedVersion } = require('../ts/util/version.js');
const shortSha = execSync('git rev-parse --short HEAD')
const shortSha = execSync('git rev-parse --short=9 HEAD')
.toString('utf8')
.replace(/[\n\r]/g, '');

View File

@@ -5,9 +5,11 @@ import type { AfterPackContext } from 'electron-builder';
import { afterPack as fuseElectron } from './fuse-electron.js';
import { afterPack as copyPacks } from './copy-language-packs.js';
import { afterPack as pruneMacOSRelease } from './prune-macos-release.js';
import { afterPack as ensureLinuxFilePermissions } from './ensure-linux-file-permissions.js';
export async function afterPack(context: AfterPackContext): Promise<void> {
await pruneMacOSRelease(context);
await fuseElectron(context);
await copyPacks(context);
await ensureLinuxFilePermissions(context);
}

View File

@@ -0,0 +1,30 @@
// Copyright 2025 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import path from 'node:path';
import { execSync } from 'node:child_process';
import type { AfterPackContext } from 'electron-builder';
const FILES = [
'resources/org.signalapp.enable-backups.policy',
'resources/org.signalapp.view-aep.policy',
];
export async function afterPack({
appOutDir,
electronPlatformName,
}: AfterPackContext): Promise<void> {
if (electronPlatformName !== 'linux') {
return;
}
console.log('Ensuring Linux file permissions');
for (const file of FILES) {
const filePath = path.join(appOutDir, file);
// u+rw g+r o+r
const command = `chmod 644 "${filePath}"`;
console.log(`Running: ${command}`);
execSync(command);
}
}