Skip to content

Commit

Permalink
Adds linux and darwin builds to release script
Browse files Browse the repository at this point in the history
  • Loading branch information
tomnomnom committed Jun 6, 2016
1 parent 5ebf58f commit c3191f3
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions script/release
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ TAG=${1}
USER="tomnomnom"
REPO="gron"
BINARY="${REPO}"
ARCHIVE="${BINARY}-linux-amd64-${TAG}.tgz"

if [[ -z "${TAG}" ]]; then
echo "Usage: ${0} <tag>"
Expand All @@ -18,20 +17,35 @@ if [[ -z "${GITHUB_TOKEN}" ]]; then
fi

cd ${PROJDIR}
go build github.com/${USER}/${REPO}
tar --create --gzip --file=${ARCHIVE} ${BINARY}

github-release release \
--user ${USER} \
--repo ${REPO} \
--tag ${TAG} \
--name "${REPO} v${TAG}" \
--description "v${TAG}" \
--pre-release

github-release upload \
--user ${USER} \
--repo ${REPO} \
--tag ${TAG} \
--name "${ARCHIVE}" \
--file ${PROJDIR}/${ARCHIVE}

# Check if tag exists
git fetch --tags
git tag | grep "^${TAG}$"

if [ $? -ne 0 ]; then
github-release release \
--user ${USER} \
--repo ${REPO} \
--tag ${TAG} \
--name "${REPO} v${TAG}" \
--description "v${TAG}" \
--pre-release
fi


for OS in "darwin" "linux"; do

rm -f ${BINARY}

GOOS=${OS} GOARCH=amd64 go build github.com/${USER}/${REPO}

ARCHIVE="${BINARY}-${OS}-amd64-${TAG}.tgz"
tar --create --gzip --file=${ARCHIVE} ${BINARY}

github-release upload \
--user ${USER} \
--repo ${REPO} \
--tag ${TAG} \
--name "${ARCHIVE}" \
--file ${PROJDIR}/${ARCHIVE}
done

0 comments on commit c3191f3

Please sign in to comment.