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

Added instructions and script to release etcd-manager-ctl binaries #227

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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://git@github.com/kopeio/etcd-manager"
echo "./dev/build-assets.sh ${VERSION}"
echo "# Finally, create a new release on GitHub attaching binary assets at dist/${VERSION}/"