From 4c97bc828cec03e99a1aa396e6dfa9bf5bfa19d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=A5=E6=B5=B7?= Date: Fri, 3 Feb 2023 00:42:34 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E8=B0=83=E6=95=B4=E5=AE=89=E8=A3=85up?= =?UTF-8?q?x=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 3 --- build.sh | 21 ++++++++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1dc55e03..30c7dcc8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,9 +23,6 @@ jobs: with: node-version: 16 - - name: Setup upx - run: apt install -y upx-ucl - - name: Run release script run: sh build.gh diff --git a/build.sh b/build.sh index e24bc0fe..86affe73 100644 --- a/build.sh +++ b/build.sh @@ -6,13 +6,8 @@ export GO111MODULE=on build() { echo building for $1/$2 - out=build/tdp-cloud-$1-$2$3 GOOS=$1 GOARCH=$2 go build -ldflags="-s -w" -o $out main.go - - if type upx >/dev/null 2>&1; then - upx --best $out - fi } #################################################################### @@ -27,3 +22,19 @@ build linux arm64 build windows amd64 .exe build windows arm64 .exe + +#################################################################### + +if type apt >/dev/null 2>&1; then + sudo apt install -y upx-ucl +fi + +if type apk >/dev/null 2>&1; then + apk add upx +fi + +if type upx >/dev/null 2>&1; then + cd build + upx --best `ls .` + cd .. +fi