tvl-depot/build-release.sh
Vincent Ambo e2be6152f9 chore: Release version 1.1.0
This release features some cleanup and under-the-hood changes, as well
as "ecosystem-features" that don't directly affect the way Kontemplate
itself functions.

* Resource-sets are now passed on to kubectl in individual
  invocations. This means that kubectl errors can be scoped to
  individual resource set files and issues such as #51 are less of a
  problem.
* A Dockerfile is provided and published at `tazjin:kontemplate` on
  Docker Hub. This image contains `kontemplate`, `kubectl` and `pass`
  and can be used - for example - as an image for a step in a CI
  system.
* Kontemplate is now available on Homebrew, check the README for
  installation instructions.

* If different resource sets don't contain `---` separators in YAML,
  `kubectl` calls will no longer fail. (#51)
* Autocompleted trailing slashes in shells are now filtered from
  include & exclude lists to enhance the CLI experience slightly.
2017-06-11 23:47:59 +02:00

55 lines
1.4 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.1.0-${GIT_HASH}"
function build-for() {
local os="${1}"
local arch="${2}"
local target="release/${os}/${arch}"
echo "Building kontemplate for ${os}-${arch} in ${target}"
mkdir -p "${target}"
env GOOS="${os}" GOARCH="${arch}" go build \
-ldflags "${LDFLAGS}" \
-o "${target}/kontemplate" \
-tags netgo
}
function sign-for() {
local os="${1}"
local arch="${2}"
local target="release/${os}/${arch}"
local bin="${target}/kontemplate"
local hash="$(sha256sum ${bin})"
local tar="release/kontemplate-${VERSION}-${os}-${arch}.tar.gz"
echo "Signing kontemplate binary for ${os}-${arch} with SHA256 ${hash}"
gpg --sign "${bin}"
echo "Packing release into ${tar}"
tar czvf "${tar}" -C "${target}" kontemplate kontemplate.gpg
}
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")
# Sign releases:
sign-for "linux" "amd64"
sign-for "darwin" "amd64"
sign-for "windows" "amd64"
sign-for "freebsd" "amd64"
exit 0
;;
esac