chore(build): Use current git commit hash as build version
This commit is contained in:
parent
7520f2cb96
commit
5c2db7b8ce
1 changed files with 4 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2019 Google LLC
|
# Copyright 2019-2021 Google LLC
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -22,12 +22,10 @@ with pkgs;
|
||||||
let
|
let
|
||||||
inherit (pkgs) buildGoPackage;
|
inherit (pkgs) buildGoPackage;
|
||||||
|
|
||||||
# Hash of all Nixery sources - this is used as the Nixery version in
|
# Current Nixery commit - this is used as the Nixery version in
|
||||||
# builds to distinguish errors between deployed versions, see
|
# builds to distinguish errors between deployed versions, see
|
||||||
# server/logs.go for details.
|
# server/logs.go for details.
|
||||||
nixery-src-hash = pkgs.runCommand "nixery-src-hash" {} ''
|
nixery-commit-hash = pkgs.lib.commitIdFromGitRepo ./.git;
|
||||||
echo ${./.} | grep -Eo '[a-z0-9]{32}' | head -c 32 > $out
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Go implementation of the Nixery server which implements the
|
# Go implementation of the Nixery server which implements the
|
||||||
# container registry interface.
|
# container registry interface.
|
||||||
|
@ -52,7 +50,7 @@ let
|
||||||
runHook renameImport
|
runHook renameImport
|
||||||
|
|
||||||
export GOBIN="$out/bin"
|
export GOBIN="$out/bin"
|
||||||
go install -ldflags "-X main.version=$(cat ${nixery-src-hash})" ${goPackagePath}
|
go install -ldflags "-X main.version=$(cat ${nixery-commit-hash})" ${goPackagePath}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
fixupPhase = ''
|
fixupPhase = ''
|
||||||
|
|
Loading…
Reference in a new issue