-
Notifications
You must be signed in to change notification settings - Fork 0
/
signal-buildscript.sh
executable file
·70 lines (68 loc) · 2.75 KB
/
signal-buildscript.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
trap '[[ $pid ]] && kill $pid; exit' EXIT
BUILD_TYPE="$1"
TEST="$2"
echo "Entering /Signal-Desktop"
pushd /Signal-Desktop
echo "Starting Build "$(date -u '+on %D at %R UTC') && echo "# Starting Build "$(date -u '+on %D at %R UTC') > release/release.sha512sum
echo "RUN_TESTS: ${TEST}"
echo "BUILD_TYPE: ${BUILD_TYPE}"
echo "SOURCE_DATE_EPOCH: ${SOURCE_DATE_EPOCH}"
git-lfs install
nvm use && npm ci
npm install
npm run clean-transpile
cd sticker-creator
npm install
npm run build
cd ..
npm run generate
if [ "${BUILD_TYPE}" = "public" ]; then
npm run prepare-beta-build
elif [ "${BUILD_TYPE}" = "alpha" ]; then
npm run prepare-alpha-version
npm run prepare-alpha-build
elif [ "${BUILD_TYPE}" = "staging" ]; then
npm run prepare-alpha-version
npm run prepare-staging-build
elif [ "${BUILD_TYPE}" = "test" ]; then
npm run prepare-alpha-version
npm run prepare-alpha-build
elif [ "${BUILD_TYPE}" = "dev" ]; then
echo "dev build, using package.json as is"
else
echo "Unknown build type ${BUILD_TYPE}"
exit 1
fi
npm run build:esbuild:prod
xvfb-run --auto-servernum npm run build:preload-cache
npm run build:release -- --arm64 --publish=never --linux deb
echo "Generating SBOM at /Signal-Desktop/release/manifest.spdx.json"
npm sbom --sbom-format="spdx" --sbom-type="application" > /Signal-Desktop/release/manifest.spdx.json
if [ "$TEST" = "yes" ]; then
xvfb-run --auto-servernum npm run test-node
xvfb-run --auto-servernum npm run test-electron
xvfb-run --auto-servernum npm run test-release
fi
debpath=$(ls /Signal-Desktop/release/signal-desktop_*)
if [ ! -f /Signal-Desktop/release/.private.key ]; then
echo "Generating New Keypair."
npm run ts/updater/generateKeyPair.js -- --key /Signal-Desktop/release/public.key --private /Signal-Desktop/release/.private.key
echo "Signing Release."
npm run sign-release -- --private /Signal-Desktop/release/.private.key --update $debpath
else
echo "Signing Release."
npm run sign-release -- --private /Signal-Desktop/release/.private.key --update $debpath
shred /Signal-Desktop/release/.private.key
rm -f /Signal-Desktop/release/.private.key
fi
pushd release/
sha512sum *.deb && sha512sum *.deb >> release.sha512sum
echo "# 0mniteck's Current GPG Key ID: 287EE837E6ED2DD3" >> release.sha512sum
echo "# Source Date Epoch: ${SOURCE_DATE_EPOCH}" >> release.sha512sum
echo "Build Complete: "$(date -u '+on %D at %R UTC') && echo "# Build Complete: "$(date -u '+on %D at %R UTC') >> release.sha512sum
echo "# Container Build System: $(uname -o) $(uname -r) $(uname -m) $(lsb_release -ds) $(uname -v)" >> release.sha512sum
ls -la
popd
popd