Skip to content

Commit

Permalink
fix(CI): add os and arch args for build
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeEirc authored and ibuler committed Jul 8, 2020
1 parent 3b491b5 commit 2552892
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion utils/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
utils_dir=$(pwd)
project_dir=$(dirname "$utils_dir")
release_dir=${project_dir}/release
OS=${INPUT_OS-''}
ARCH=${INPUT_ARCH-''}

function install_git() {
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
Expand All @@ -30,7 +32,7 @@ fi

# 下载依赖模块并构建
cd .. && go mod download || exit 3
cd cmd && go build -ldflags "-X 'main.Buildstamp=`date -u '+%Y-%m-%d %I:%M:%S%p'`' -X 'main.Githash=`git rev-parse HEAD`' -X 'main.Goversion=`go version`'" -o koko koko.go || exit 4
cd cmd && CGO_ENABLED=0 GOOS="$OS" GOARCH="$ARCH" go build -ldflags "-X 'main.Buildstamp=`date -u '+%Y-%m-%d %I:%M:%S%p'`' -X 'main.Githash=`git rev-parse HEAD`' -X 'main.Goversion=`go version`'" -o koko koko.go || exit 4

# 打包
rm -rf "${release_dir:?}/*"
Expand Down

0 comments on commit 2552892

Please sign in to comment.