-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.sh
executable file
·32 lines (24 loc) · 958 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
version=$(git describe --tags --always)
if [ -z "$1" ]
then
echo "No channel supplied"
exit 1
fi
channel=$1
force="false"
if [[ $2 == "--force" ]]
then
force="true"
fi
echo "Building $channel/$version"
echo
rm build/*
curl -s http://downloads.cloud66.com.s3.amazonaws.com/copper/versions.json | jq '.versions |= map(if (.channel == "'$channel'") then .version = "'$version'" else . end) | .versions |= map(if (.channel == "'$channel'") then .force = '$force' else . end)' > build/versions.json
echo "Current Versions"
cat build/versions.json | jq -r '.versions | map([.channel, .version] | join(": ")) | .[]'
echo
packr2
# for now we're not building for windows as a result of an issue with gox + godirwalk
gox -ldflags "-X github.com/cloud66-oss/copper/utils.Version=$version -X github.com/cloud66-oss/copper/utils.Channel=$channel" -os="darwin linux" -arch="amd64" -output "build/{{.OS}}_{{.Arch}}_$version"
packr2 clean