-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd59831
commit 60cae67
Showing
5 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# This script builds Gex for multiple platforms and creates a tarball for each platform. | ||
# It clones the Gex repository, checks out the specified version, and builds the binary for each platform. | ||
# The resulting tarballs are saved in the gex directory. | ||
|
||
set -e | ||
|
||
GIT_REPOSITORY="https://github.com/cosmos/gex.git" | ||
VERSION="v1.3.0" | ||
GOROOT=$(go env GOROOT) | ||
WORKDIR=$(pwd) | ||
PLATFORMS="darwin/amd64 darwin/arm64 linux/amd64 linux/arm64" | ||
|
||
# Cleans up temporary files and directories | ||
clean_up() { | ||
test -d "$tmp_dir" && rm -fr "$tmp_dir" | ||
} | ||
|
||
# Creates a temporary directory and sets up a trap to clean it up on exit | ||
tmp_dir=$(mktemp -d -t gex.XXXXXX) | ||
trap "clean_up $tmp_dir" EXIT | ||
|
||
# Clones the Gex repository into the temporary directory | ||
git clone ${GIT_REPOSITORY} ${tmp_dir} --depth 1 | ||
cd ${tmp_dir} | ||
echo | ||
|
||
# Builds Gex for each platform and creates a tarball for each one | ||
for platform in ${PLATFORMS} | ||
do | ||
goos=${platform%/*} | ||
goarch=${platform#*/} | ||
|
||
echo "Building Gex for $goos/$goarch" | ||
GOOS=$goos GOARCH=$goarch go build -o gex 2>&1 | ||
|
||
out="${WORKDIR}/gex/gex-${VERSION}-${goarch}-${goos}.tar.gz" | ||
tar -czf ${out} gex | ||
done |