-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrelease_noeth.sh
executable file
·59 lines (50 loc) · 1.33 KB
/
release_noeth.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
set -e
package="github.com/threefoldfoundation/tfchain"
version=$(git describe --abbrev=0)
commit="$(git rev-parse --short HEAD)"
if [ "$commit" == "$(git rev-list -n 1 $version | cut -c1-7)" ]
then
full_version="$version"
else
full_version="${version}-${commit}"
fi
ARCHIVE=false
if [ "$1" = "archive" ]; then
ARCHIVE=true
shift # remove element from arguments
fi
# Overide the file names to edge version, keep full version at the git commit since
# that is the expected format
if [ "$1" = "edge" ]; then
version="edge"
fi
echo "building version ${version}"
for os in darwin linux; do
echo Packaging ${os}...
# create workspace
folder="release/tfchain-noeth-${version}-${os}-amd64"
rm -rf "$folder"
mkdir -p "$folder"
# compile and sign binaries
for pkg in cmd/tfchainc cmd/tfchaind; do
GOOS=${os} go build -a \
-ldflags="-X ${package}/pkg/config.rawVersion=${full_version} -s -w" \
-tags="noeth" -o "${folder}/${pkg}" "./${pkg}"
done
if [ "$ARCHIVE" = true ] ; then
# add other artifacts
cp -r doc LICENSE README.md "$folder"
# go into the release directory
pushd release &> /dev/null
# zip
(
zip -rq "tfchain-noeth-${version}-${os}-amd64.zip" \
"tfchain-noeth-${version}-${os}-amd64"
)
# leave the release directory
popd &> /dev/null
# clean up workspace dir
rm -rf "$folder"
fi
done