Skip to content

Commit

Permalink
chore: 调整安装upx兼容性
Browse files Browse the repository at this point in the history
  • Loading branch information
rehiy committed Feb 2, 2023
1 parent dbf23eb commit 4c97bc8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 16 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

####################################################################
Expand All @@ -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

0 comments on commit 4c97bc8

Please sign in to comment.