Skip to content

Commit

Permalink
Add build-gex script
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehsan-saradar committed Oct 9, 2023
1 parent bd59831 commit 60cae67
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
Binary file modified gex/gex-v1.3.0-amd64-darwin.tar.gz
Binary file not shown.
Binary file modified gex/gex-v1.3.0-amd64-linux.tar.gz
Binary file not shown.
Binary file modified gex/gex-v1.3.0-arm64-darwin.tar.gz
Binary file not shown.
Binary file modified gex/gex-v1.3.0-arm64-linux.tar.gz
Binary file not shown.
40 changes: 40 additions & 0 deletions scripts/build-gex
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

0 comments on commit 60cae67

Please sign in to comment.