-
Notifications
You must be signed in to change notification settings - Fork 6
/
create-releases.sh
executable file
·38 lines (30 loc) · 1.39 KB
/
create-releases.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
#!/usr/bin/env sh
# get the current version of the tool from `./current_version`
VERSION=$(cat current_version)
FLAGS="-X main.AppVersion=$VERSION -s -w"
# if no $1 argument is provided, we simply generate all releases
if [ -z "$1" ]; then
rm -rf releases
mkdir -p releases
# build for Windows
GOOS=windows GOARCH=amd64 go build -ldflags="$FLAGS" -trimpath
mv veracode-js-packager.exe releases/veracode-js-packager-windows-amd64.exe
# build for M1 Macs (arm64)
GOOS=darwin GOARCH=arm64 go build -ldflags="$FLAGS" -trimpath
mv veracode-js-packager releases/veracode-js-packager-mac-arm64
# build for Intel Macs (amd64)
GOOS=darwin GOARCH=amd64 go build -ldflags="$FLAGS" -trimpath
mv veracode-js-packager releases/veracode-js-packager-mac-amd64
# build for x64 Linux (amd64)
GOOS=linux GOARCH=amd64 go build -ldflags="$FLAGS" -trimpath
mv veracode-js-packager releases/veracode-js-packager-linux-amd64
else
# check if `./create-releases.sh docker` is ran which means we only compile for the architecture of the container
if [ $1 = "docker" ]; then
go build -ldflags="$FLAGS" -trimpath -o veracode-js-packager
fi
# check if `./create-releases.sh local` is ran which means we only compile for the architecture of the current machine
if [ $1 = "local" ]; then
go build -ldflags="$FLAGS" -trimpath -o veracode-js-packager
fi
fi