Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
Merge pull request #227 from pracucci/add-instructions-to-release-etc…
Browse files Browse the repository at this point in the history
…d-manager-ctl-binaries

Added instructions and script to release etcd-manager-ctl binaries
  • Loading branch information
justinsb authored Jul 30, 2019
2 parents 8a739a7 + 6f41b99 commit 0e48acd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ bazel-testlogs
# We often create some local symlinks
/etcd-manager
/etcd-manager-ctl

# Release assets
dist/
36 changes: 36 additions & 0 deletions dev/build-assets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

VERSION=$1
PLATFORMS="linux_amd64 darwin_amd64 windows_amd64"
CMDS="etcd-manager-ctl"

# Ensure the dist folder exists and is clean
rm -fr dist/${VERSION} && mkdir -p dist/${VERSION}

for CMD in ${CMDS}; do
for PLATFORM in ${PLATFORMS}; do
CMD_DIST_PATH="dist/${VERSION}/${CMD}-${PLATFORM/_/-}"

# Get the expected binary file extension
if [[ "${PLATFORM}" =~ "windows" ]]; then
EXTENSION=".exe"
else
EXTENSION=""
fi

# Build
bazel build --platforms=@io_bazel_rules_go//go/toolchain:${PLATFORM} //cmd/${CMD}

if [ -e "bazel-bin/cmd/${CMD}/${PLATFORM}_stripped/${CMD}${EXTENSION}" ]; then
cp bazel-bin/cmd/${CMD}/${PLATFORM}_stripped/${CMD}${EXTENSION} ${CMD_DIST_PATH}
elif [ -e "bazel-bin/cmd/${CMD}/${PLATFORM}_pure_stripped/${CMD}${EXTENSION}" ]; then
cp bazel-bin/cmd/${CMD}/${PLATFORM}_pure_stripped/${CMD}${EXTENSION} ${CMD_DIST_PATH}
else
echo "Unable to find compiled binary for ${CMD} ${PLATFORM}"
exit 1
fi

# Generate SHA-256
shasum -a 256 ${CMD_DIST_PATH} | cut -d ' ' -f 1 > ${CMD_DIST_PATH}-sha-256
done
done
8 changes: 6 additions & 2 deletions dev/release.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/bin/bash

TODAY=`date +%Y%m%d`
VERSION="3.0.${TODAY}"

echo "# Run these commands to do a release"
echo "DOCKER_IMAGE_PREFIX=kopeio/ DOCKER_TAG=3.0.${TODAY} make push"
echo "DOCKER_IMAGE_PREFIX=kopeio/ DOCKER_TAG=${VERSION} make push"
echo "DOCKER_IMAGE_PREFIX=kopeio/ DOCKER_TAG=latest make push"
echo "git tag 3.0.${TODAY}"
echo "git tag ${VERSION}"
echo "git push --tags ssh://[email protected]/kopeio/etcd-manager"
echo "./dev/build-assets.sh ${VERSION}"
echo "# Finally, create a new release on GitHub attaching binary assets at dist/${VERSION}/"

0 comments on commit 0e48acd

Please sign in to comment.