Linux builds: Default SOURCE_DATE_EPOCH to 1

This commit is contained in:
ayumi-signal 2024-08-21 11:01:33 -07:00 committed by GitHub
parent 2fb50df0af
commit c86b0a9bab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -5,7 +5,7 @@ FROM ubuntu:jammy-20230624@sha256:b060fffe8e1561c9c3e6dea6db487b900100fc26830b9e
# UNIX timestamp will be generated at the time of the build, and is non-deterministic. # UNIX timestamp will be generated at the time of the build, and is non-deterministic.
# #
# Read https://reproducible-builds.org/specs/source-date-epoch/ for more info # Read https://reproducible-builds.org/specs/source-date-epoch/ for more info
ENV SOURCE_DATE_EPOCH=0 ENV SOURCE_DATE_EPOCH=1
# Due to some issues with NVM reading .nvmrc, we define the version # Due to some issues with NVM reading .nvmrc, we define the version
# as an environment variable and use that instead. # as an environment variable and use that instead.

View file

@ -3,18 +3,18 @@
# 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 0. ] # ./build.sh [ dev (default) | public (prod and beta builds) | alpha | test | staging ] [ Build timestamp override. Defaults to latest git commit or 1. ]
# 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.
# We set SOURCE_DATE_EPOCH to make system build timestamps deterministic. # We set SOURCE_DATE_EPOCH to make system build timestamps deterministic.
docker build -t signal-desktop --build-arg SOURCE_DATE_EPOCH=0 --build-arg NODE_VERSION=$(cat ../.nvmrc) . docker build -t signal-desktop --build-arg SOURCE_DATE_EPOCH=1 --build-arg NODE_VERSION=$(cat ../.nvmrc) .
# Before performing the actual build, go to the project root. # Before performing the actual build, go to the project root.
cd .. 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=0 source_date_epoch=1
if [ "$2" != "" ]; then if [ "$2" != "" ]; then
echo "Using override timestamp for SOURCE_DATE_EPOCH." echo "Using override timestamp for SOURCE_DATE_EPOCH."
source_date_epoch=$(($2)) source_date_epoch=$(($2))
@ -25,8 +25,8 @@ else
echo "Setting SOURCE_DATE_EPOCH to latest commit's timestamp." echo "Setting SOURCE_DATE_EPOCH to latest commit's timestamp."
source_date_epoch=$((git_timestamp)) source_date_epoch=$((git_timestamp))
else else
echo "Can't get latest commit timestamp. Defaulting to 0." echo "Can't get latest commit timestamp. Defaulting to 1."
source_date_epoch=0 source_date_epoch=1
fi fi
fi fi