Skip to content

Commit 52d1369

Browse files
committed
chore: build
Signed-off-by: lux5am <lux.5am@yandex.com>
1 parent c2c301d commit 52d1369

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ jobs:
263263
echo "VERSION=${VERSION}" >> $GITHUB_ENV
264264
echo "PackageVersion=${PackageVersion}" >> $GITHUB_ENV
265265
266-
echo "BUILDTIME=$(date)" >> $GITHUB_ENV
266+
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
267267
echo "CGO_ENABLED=0" >> $GITHUB_ENV
268268
echo "BUILDTAG=-extldflags --static" >> $GITHUB_ENV
269269
echo "GOTOOLCHAIN=local" >> $GITHUB_ENV
@@ -306,10 +306,18 @@ jobs:
306306
run: |
307307
go env
308308
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$')"
309312
if [ "${{matrix.jobs.goos}}" = "windows" ]; then
313+
$UPX --lzma --best mihomo.exe || true
310314
cp mihomo.exe mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}.exe
311315
zip -r mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.zip mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}.exe
312316
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
313321
cp mihomo mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}
314322
gzip -c mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}} > mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.gz
315323
rm mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}

0 commit comments

Comments
 (0)