Skip to content

Commit

Permalink
Adds darwin/arm64 as a build target
Browse files Browse the repository at this point in the history
Also adds `$GOARCH` to the the build paths, since there are two darwin targets now (otherwise one would overwrite the other).
  • Loading branch information
simpson-ross committed Jun 28, 2023
1 parent 988642d commit 314aa8f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions script/build
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if [ -d build ]; then
fi
mkdir -p build

platforms=("windows/amd64" "linux/amd64" "darwin/amd64")
platforms=("windows/amd64" "linux/amd64" "darwin/amd64" "darwin/arm64")

echo "==> Build started for v${version}"

Expand All @@ -35,9 +35,9 @@ do
GCFLAGS="-gcflags=all=-trimpath=$GOPATH -asmflags=all=-trimpath=$GOPATH"

if [ $GOOS = "windows" ]; then
env GOOS=$GOOS GOARCH=$GOARCH go build $GCFLAGS -o "build/${GOOS}/cf-vault.exe" -ldflags "-X github.com/jacobbednarz/cf-vault/cmd.Rev=${version_with_sha}" .
env GOOS=$GOOS GOARCH=$GOARCH go build $GCFLAGS -o "build/${GOOS}/${GOARCH}/cf-vault.exe" -ldflags "-X github.com/jacobbednarz/cf-vault/cmd.Rev=${version_with_sha}" .
else
env GOOS=$GOOS GOARCH=$GOARCH go build $GCFLAGS -o "build/${GOOS}/cf-vault" -ldflags "-X github.com/jacobbednarz/cf-vault/cmd.Rev=${version_with_sha}" .
env GOOS=$GOOS GOARCH=$GOARCH go build $GCFLAGS -o "build/${GOOS}/${GOARCH}/cf-vault" -ldflags "-X github.com/jacobbednarz/cf-vault/cmd.Rev=${version_with_sha}" .
fi
if [ $? -ne 0 ]; then
echo "Building the binary has failed!"
Expand All @@ -48,9 +48,9 @@ do

printf "==> Tarballing %s\t%s\n" "$platform" "build/${output_name}.tar.gz" | expand -t 30
if [ $GOOS = "windows" ]; then
tar -czf "build/${output_name}.tar.gz" -C "build/$GOOS" "cf-vault.exe"
tar -czf "build/${output_name}.tar.gz" -C "build/$GOOS/$GOARCH" "cf-vault.exe"
else
tar -czf "build/${output_name}.tar.gz" -C "build/$GOOS" "cf-vault"
tar -czf "build/${output_name}.tar.gz" -C "build/$GOOS/$GOARCH" "cf-vault"
fi

if [ $? -ne 0 ]; then
Expand All @@ -59,7 +59,7 @@ do
fi

echo "==> Adding file checksums to build/checksums.txt"
shasum -a 256 build/$GOOS/* >> "build/checksums.txt"
shasum -a 256 build/$GOOS/$GOARCH/* >> "build/checksums.txt"
done

shasum -a 256 build/*.tar.gz >> "build/checksums.txt"
Expand Down

0 comments on commit 314aa8f

Please sign in to comment.