Skip to content

Commit

Permalink
create binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
nxadm committed Jan 10, 2021
1 parent 86ffd58 commit 9713fb4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
*.dll
*.so
*.dylib
certmin
certmin*
binaries/

# Test binary, built with `go test -c`
*.test
Expand Down
31 changes: 31 additions & 0 deletions create_binaries.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash -e
set -xv
APP=certmin
BIN_DIR=binaries
PLATFORMS=("windows/amd64" "darwin/amd64" "linux/amd64")
SRC_DIR=$(pwd)
#BUILD_CMD="go build -a -installsuffix cgo -ldflags -s"
BUILD_CMD="go build"
VERSION=$(git describe --tags)

function build {
GOOS=$1
GOARCH=$2
OUTPUT="${APP}-${VERSION}-${GOOS}-${GOARCH}"
if [ $GOOS = "windows" ]; then
OUTPUT+='.exe'
fi
GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=0 $BUILD_CMD -o $BIN_DIR/$OUTPUT
cd $BIN_DIR
sha512sum $OUTPUT > $OUTPUT.sha512
cat $OUTPUT.sha512
cd $SRC_DIR
}

mkdir -p $BIN_DIR
for i in ${PLATFORMS[@]}; do
PLATFORMS_SPLIT=(${i//\// })
GOOS=${PLATFORMS_SPLIT[0]}
GOARCH=${PLATFORMS_SPLIT[1]}
build $GOOS $GOARCH
done

0 comments on commit 9713fb4

Please sign in to comment.