diff --git a/build.sh b/build.sh index cb2bdf3c..13aab766 100644 --- a/build.sh +++ b/build.sh @@ -1,5 +1,7 @@ #!/bin/bash +#github action release.sh + set -x function RETVAL() { rt=$1 @@ -11,41 +13,46 @@ function RETVAL() { #当前目录 cpath=$(pwd) -#ver=`cat server/base/app_ver.go | grep APP_VER | awk '{print $3}' | sed 's/"//g'` -ver=$(cat version) -echo "当前版本 $ver" - -echo "编译前端项目" -cd $cpath/web -#国内可替换源加快速度 -#npx browserslist@latest --update-db -yarn install --registry=https://registry.npmmirror.com -yarn run build -RETVAL $? +ver=$(cat version) +echo $ver -echo "编译二进制文件" +echo "copy二进制文件" cd $cpath/server -rm -rf ui -cp -rf $cpath/web/ui . - # -tags osusergo,netgo,sqlite_omit_load_extension -# -tags musl -flags="-v -trimpath" - -# -linkmode external -# -extldflags '-static' -ldflags="-s -w -X main.appVer=$ver -X main.commitId=$(git rev-parse HEAD) -X main.date=$(date -Iseconds)" +flags="-trimpath" +ldflags="-s -w -extldflags '-static' -X main.appVer=$ver -X main.commitId=$(git rev-parse HEAD) -X main.buildDate=$(date --iso-8601=seconds)" +#github action +gopath=/go -#国内可替换源加快速度 -export GOPROXY=https://goproxy.io +dockercmd=$( + cat <