tvl-depot/build-release.sh
Vincent Ambo f8b6ad652d
Version 1.2.0
This release comes with some new features, usability improvements and
a better build & release process.

Features:

* Documentation has been improved significantly, check out the new
  [README][] and follow the links within!
* Extra variables can now be loaded from files on disk. Simply specify
  a list of YAML/JSON files under the 'import' key in your cluster
  context file. Check out #66 for details!
* Resource set paths can now be overridden by users. By default it is
  assumed that the path to a resource set is the same as its name,
  however this is now user-controllable.
  This means the same resource set can be included multiple times
  under different names, for easier including/excluding. See #71 for
  details!
* Kontemplate is currently getting a website that is under construction
  at [kontemplate.works][] - feel free to check it out and
  [give feedback][]!

Fixes:

* Windows release binaries now have the correct filename
* Several potential warning and error messages have been improved

Release binaries are signed with GPG key `66F505681DB8F43B` which is
verified on my Github profile.

[README]: https://github.com/tazjin/kontemplate/blob/master/README.md
[kontemplate.works]: http://kontemplate.works/
[give feedback]: https://github.com/tazjin/kontemplate-website/issues
2017-08-22 19:18:14 +02:00

66 lines
1.7 KiB
Bash
Executable file

#!/bin/bash
set -ueo pipefail
readonly GIT_HASH="$(git rev-parse --short HEAD)"
readonly LDFLAGS="-X main.gitHash=${GIT_HASH} -w -s"
readonly VERSION="1.2.0-${GIT_HASH}"
function binary-name() {
local os="${1}"
local target="${2}"
if [ "${os}" = "windows" ]; then
echo -n "${target}/kontemplate.exe"
else
echo -n "${target}/kontemplate"
fi
}
function build-for() {
local os="${1}"
local arch="${2}"
local target="release/${os}/${arch}"
local bin=$(binary-name "${os}" "${target}")
echo "Building kontemplate for ${os}-${arch} in ${target}"
mkdir -p "${target}"
env GOOS="${os}" GOARCH="${arch}" go build \
-ldflags "${LDFLAGS}" \
-o "${bin}" \
-tags netgo
}
function sign-for() {
local os="${1}"
local arch="${2}"
local target="release/${os}/${arch}"
local bin=$(binary-name "${os}" "${target}")
local tar="release/kontemplate-${VERSION}-${os}-${arch}.tar.gz"
echo "Packing release into ${tar}"
tar czvf "${tar}" -C "${target}" $(basename "${bin}")
local hash=$(sha256sum "${tar}")
echo "Signing kontemplate release tarball for ${os}-${arch} with SHA256 ${hash}"
gpg --armor --detach-sig --sign "${tar}"
}
case "${1}" in
"build")
# Build releases for various operating systems:
build-for "linux" "amd64"
build-for "darwin" "amd64"
build-for "windows" "amd64"
build-for "freebsd" "amd64"
exit 0
;;
"sign")
# Bundle and sign releases:
sign-for "linux" "amd64"
sign-for "darwin" "amd64"
sign-for "windows" "amd64"
sign-for "freebsd" "amd64"
exit 0
;;
esac