Skip to content

Commit e84b4d9

Browse files
authored
Add a release script to build linux packages (#3)
1 parent b1f70eb commit e84b4d9

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*.so
66
*.dylib
77
terrafile
8+
output
89

910
# Test binary, build with `go test -c`
1011
*.test

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
release:
2+
./scripts/binary-release.sh

scripts/binary-release.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# clean up
4+
echo "-> running clean up...."
5+
rm -rf output/*
6+
7+
# install gox
8+
if ! which gox > /dev/null; then
9+
echo "-> installing gox..."
10+
go get -u github.com/mitchellh/gox
11+
fi
12+
13+
# build
14+
echo "-> building..."
15+
gox \
16+
-os="linux" \
17+
-arch="amd64" \
18+
-output "output/{{.OS}}_{{.Arch}}/terrafile" \
19+
.
20+
21+
# Zip and copy to the dist dir
22+
echo ""
23+
echo "Packaging..."
24+
for PLATFORM in $(find ./output -mindepth 1 -maxdepth 1 -type d); do
25+
OSARCH=$(basename ${PLATFORM})
26+
echo "--> ${OSARCH}"
27+
28+
pushd $PLATFORM >/dev/null 2>&1
29+
zip ../terrafile_${OSARCH}.zip ./*
30+
done

0 commit comments

Comments
 (0)