-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathbuild.sh
35 lines (29 loc) · 1.81 KB
/
build.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
#!/bin/bash
version=$1
if [ -z "$version" ]; then
echo "version is needed"
exit -1
fi
rm -rf _dist || true
mkdir -p _dist
# env GOOS=windows GOARCH=amd64 go build -ldflags "-X github.com/rajatjindal/kubectl-whoami/cmd.Version=$version" -o _dist/kubectl-whoami-windows-amd64-$version.exe main.go
env GOOS=darwin GOARCH=amd64 go build -ldflags "-w -s -X github.com/rajatjindal/kubectl-whoami/pkg/cmd.Version=$version" -o _dist/darwin-amd64/kubectl-whoami main.go
cp LICENSE _dist/darwin-amd64/
cd _dist/darwin-amd64/ && tar -cvzf darwin-amd64-$version.tar.gz kubectl-whoami LICENSE
shasum -a 256 darwin-amd64-$version.tar.gz | awk '{print $1}' > sha256-darwin-amd64-$version
cd -
env GOOS=darwin GOARCH=arm64 go build -ldflags "-w -s -X github.com/rajatjindal/kubectl-whoami/pkg/cmd.Version=$version" -o _dist/darwin-arm64/kubectl-whoami main.go
cp LICENSE _dist/darwin-arm64/
cd _dist/darwin-arm64/ && tar -cvzf darwin-arm64-$version.tar.gz kubectl-whoami LICENSE
shasum -a 256 darwin-arm64-$version.tar.gz | awk '{print $1}' > sha256-darwin-arm64-$version
cd -
env GOOS=linux GOARCH=amd64 go build -ldflags "-w -s -X github.com/rajatjindal/kubectl-whoami/pkg/cmd.Version=$version" -o _dist/linux-amd64/kubectl-whoami main.go
cp LICENSE _dist/linux-amd64/
cd _dist/linux-amd64/ && tar -cvzf linux-amd64-$version.tar.gz kubectl-whoami LICENSE
shasum -a 256 linux-amd64-$version.tar.gz | awk '{print $1}' > sha256-linux-amd64-$version
cd -
env GOOS=linux GOARCH=arm64 go build -ldflags "-w -s -X github.com/rajatjindal/kubectl-whoami/pkg/cmd.Version=$version" -o _dist/linux-arm64/kubectl-whoami main.go
cp LICENSE _dist/linux-arm64/
cd _dist/linux-arm64/ && tar -cvzf linux-arm64-$version.tar.gz kubectl-whoami LICENSE
shasum -a 256 linux-arm64-$version.tar.gz | awk '{print $1}' > sha256-linux-arm64-$version
cd -