@@ -263,7 +263,7 @@ jobs:
263
263
echo "VERSION=${VERSION}" >> $GITHUB_ENV
264
264
echo "PackageVersion=${PackageVersion}" >> $GITHUB_ENV
265
265
266
- echo "BUILDTIME=$(date)" >> $GITHUB_ENV
266
+ echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
267
267
echo "CGO_ENABLED=0" >> $GITHUB_ENV
268
268
echo "BUILDTAG=-extldflags --static" >> $GITHUB_ENV
269
269
echo "GOTOOLCHAIN=local" >> $GITHUB_ENV
@@ -306,10 +306,18 @@ jobs:
306
306
run : |
307
307
go env
308
308
go build -v -tags "with_gvisor" -trimpath -ldflags "${BUILDTAG} -X 'github.com/metacubex/mihomo/constant.Version=${VERSION}' -X 'github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}' -w -s -buildid="
309
+ # sudo apt-get install -y upx; UPX=$(which upx)
310
+ # UPX=$(curl -sL $(curl -sL "https://api.github.com/repos/upx/upx/releases/latest" |jq -r '.assets[].browser_download_url' |grep 'amd64' |head -1) |tar xvJf - |grep '/upx$')
311
+ UPX="$(curl --retry 5 --retry-all-errors -sL "https://github.com/upx/upx/releases$(curl --retry 5 --retry-all-errors -sL "https://github.com/upx/upx/releases$(curl --retry 5 --retry-all-errors -sL "https://github.com/upx/upx/releases/latest" | grep -Eo '/expanded_assets/[^\"]+')" | grep -Eo '/download/[^"]+amd64_linux[^"]+')" |tar xvJf - |grep '/upx$')"
309
312
if [ "${{matrix.jobs.goos}}" = "windows" ]; then
313
+ $UPX --lzma --best mihomo.exe || true
310
314
cp mihomo.exe mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}.exe
311
315
zip -r mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.zip mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}.exe
312
316
else
317
+ # if [ "${{matrix.jobs.goos}}" = "linux" ] && [ "${{matrix.jobs.goarch}}" = "arm64" ]; then
318
+ # UPX=$(curl -L $(curl -sL "https://api.github.com/repos/upx/upx/releases/latest" |jq -r '.assets[].browser_download_url' |grep 'amd64' |head -1) |tar xvJf - |grep '/upx$')
319
+ $UPX --lzma --best mihomo || true
320
+ # fi
313
321
cp mihomo mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}
314
322
gzip -c mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}} > mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.gz
315
323
rm mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}
0 commit comments