harbor/make/photon/chartserver/compile.sh
Qian Deng 5cd3594f20 Upgrade chartmuseum from v0.8.1 to v0.9.0
Signed-off-by: Qian Deng <dengqian0826@gmail.com>
2019-07-17 06:45:23 +00:00

32 lines
555 B
Bash

#!/bin/bash
set +e
usage(){
echo "Usage: compile.sh <code path> <code tag> <main.go path> <binary name>"
echo "e.g: compile.sh github.com/helm/chartmuseum v0.5.1 cmd/chartmuseum chartm"
exit 1
}
if [ $# != 4 ]; then
usage
fi
GIT_PATH="$1"
VERSION="$2"
MAIN_GO_PATH="$3"
BIN_NAME="$4"
#Get the source code
git clone $GIT_PATH src_code
ls
SRC_PATH=$(pwd)/src_code
set -e
#Checkout the released tag branch
cd $SRC_PATH
git checkout tags/$VERSION -b $VERSION
#Compile
cd $SRC_PATH/$MAIN_GO_PATH && go build -a -o $BIN_NAME
mv $BIN_NAME /go/bin/