Skip to content

Commit

Permalink
Add a release script to build linux packages (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fauzyy authored Apr 15, 2019
1 parent b1f70eb commit e84b4d9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.so
*.dylib
terrafile
output

# Test binary, build with `go test -c`
*.test
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
release:
./scripts/binary-release.sh
30 changes: 30 additions & 0 deletions scripts/binary-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# clean up
echo "-> running clean up...."
rm -rf output/*

# install gox
if ! which gox > /dev/null; then
echo "-> installing gox..."
go get -u github.com/mitchellh/gox
fi

# build
echo "-> building..."
gox \
-os="linux" \
-arch="amd64" \
-output "output/{{.OS}}_{{.Arch}}/terrafile" \
.

# Zip and copy to the dist dir
echo ""
echo "Packaging..."
for PLATFORM in $(find ./output -mindepth 1 -maxdepth 1 -type d); do
OSARCH=$(basename ${PLATFORM})
echo "--> ${OSARCH}"

pushd $PLATFORM >/dev/null 2>&1
zip ../terrafile_${OSARCH}.zip ./*
done

0 comments on commit e84b4d9

Please sign in to comment.