Skip to content

Commit

Permalink
packaging: build "release" versions
Browse files Browse the repository at this point in the history
  • Loading branch information
strib committed Feb 5, 2023
1 parent 0befa77 commit a2fd3ee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
5 changes: 3 additions & 2 deletions packaging/linux/build_and_package_binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
set -euox pipefail

here="$(dirname "${BASH_SOURCE[0]}")"
build_root="${1:-/tmp/keybase_build_$(date +%Y_%m_%d_%H%M%S)}"
mode="${1:-dev}"
build_root="${2:-/tmp/keybase_build_$(date +%Y_%m_%d_%H%M%S)}"

$here/build_binary.sh $build_root
$here/build_binary.sh $mode $build_root
$here/deb/package_binary.sh $build_root
5 changes: 3 additions & 2 deletions packaging/linux/build_binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ this_repo="$(git -C "$here" rev-parse --show-toplevel ||
# Take the first argument as the build root, or a tmp dir if there is no
# second argument. Absolutify the build root, because we cd around in this
# script, and also because GOPATH is not allowed to be relative.
build_root="${1:-/tmp/keybase_build_$(date +%Y_%m_%d_%H%M%S)}"
mode="$1"
build_root="${2:-/tmp/keybase_build_$(date +%Y_%m_%d_%H%M%S)}"
mkdir -p "$build_root"
build_root="$(realpath "$build_root")"

# Record the version now, and write it to the build root. Because it
# uses a timestamp, it's important that other scripts use this file
# instead of recomputing the version themselves.
version="$("$here/../version.sh" "$@")"
version="$("$here/../version.sh" "$mode")"
echo -n "$version" > "$build_root/VERSION"

echo "Building version $version in $build_root"
Expand Down
11 changes: 7 additions & 4 deletions packaging/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
set -e -u -o pipefail

here="$(dirname "$BASH_SOURCE")"
mode="${1:-dev}"

version_file="$(dirname "$BASH_SOURCE")/../version.go"
version="$(cat "$version_file" | grep 'Version =' | grep -oE '[0-9]+(.[0-9]+)+')"
build=""

current_date="$(date -u +%Y%m%d%H%M%S)" # UTC
commit_short="$(git -C "$here" log -1 --pretty=format:%h || \
echo -n ${SOURCE_COMMIT:0:10})"
build="-$current_date+$commit_short"
if [ ! "$mode" = "release" ] ; then
current_date="$(date -u +%Y%m%d%H%M%S)" # UTC
commit_short="$(git -C "$here" log -1 --pretty=format:%h || \
echo -n ${SOURCE_COMMIT:0:10})"
build="-$current_date+$commit_short"
fi

echo "$version$build"

0 comments on commit a2fd3ee

Please sign in to comment.