goreleaser scripts for building/creating a release on a workstation

Signed-off-by: Steve Kriss <steve@heptio.com>
This commit is contained in:
Steve Kriss
2018-10-25 13:47:26 -06:00
parent 21a2a2e1f5
commit 18b434cb24
3 changed files with 108 additions and 0 deletions

52
hack/goreleaser.sh Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/bash
# Copyright 2018 the Heptio Ark contributors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
# $PUBLISH must explicitly be set to 'true' for goreleaser
# to publish the release to GitHub.
if [ "${PUBLISH:-}" != "true" ]; then
SKIP_PUBLISH="--skip-publish"
else
SKIP_PUBLISH=""
fi
if [ -z "${GITHUB_TOKEN}" ]; then
echo "GITHUB_TOKEN must be set"
exit 1
fi
# TODO derive this from the major+minor version
if [ -z "${RELEASE_NOTES_FILE}" ]; then
echo "RELEASE_NOTES_FILE must be set"
exit 1
fi
export GIT_SHA=$(git describe --tags --always)
GIT_DIRTY=$(git status --porcelain 2> /dev/null)
if [[ -z "${GIT_DIRTY}" ]]; then
export GIT_TREE_STATE=clean
else
export GIT_TREE_STATE=dirty
fi
goreleaser release \
--rm-dist \
--release-notes="${RELEASE_NOTES_FILE}" \
"${SKIP_PUBLISH}"