From bd0bcb4b66f50e5373b13ef3c63719ce3b6e0f41 Mon Sep 17 00:00:00 2001 From: dawnnnnnn Date: Mon, 6 Dec 2021 17:42:25 +0800 Subject: [PATCH] feat(*): add `upx --best` for most elf --- .github/conf/.goreleaser.yml | 37 +++++++++++++++++++++++++++++------ .github/workflows/release.yml | 3 ++- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/.github/conf/.goreleaser.yml b/.github/conf/.goreleaser.yml index 0e36d07..d11b685 100644 --- a/.github/conf/.goreleaser.yml +++ b/.github/conf/.goreleaser.yml @@ -1,13 +1,10 @@ -# This is an example .goreleaser.yml file with some sane defaults. -# Make sure to check the documentation at http://goreleaser.com before: hooks: - # You may remove this if you don't use go modules. - go mod tidy - # you may remove this if you don't need go generate - go generate ./... builds: - - env: + - id: "with-upx" + env: - CGO_ENABLED=0 goos: - linux @@ -18,7 +15,6 @@ builds: - arm64 - arm - "386" - - mips64 goarm: - "6" - "7" @@ -29,6 +25,35 @@ builds: ignore: - goos: windows goarch: arm64 + - goos: windows + goarch: arm + - goos: linux + goarch: mips64 + hooks: + post: upx --best -f -q "{{ .Path }}" + +# UnknownExecutableFormatException +# CantPackException: can't pack new-exe + - id: "without-upx" + env: + - CGO_ENABLED=0 + goos: + - linux + - windows + goarch: + - mips64 + - arm + goarm: + - "6" + - "7" + flags: + - -trimpath + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser + ignore: + - goos: linux + goarch: arm + archives: - replacements: darwin: Darwin diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f16919b..24c0b44 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,7 @@ permissions: jobs: goreleaser: runs-on: ubuntu-latest + timeout-minutes: 60 steps: - name: Checkout @@ -28,7 +29,7 @@ jobs: with: distribution: goreleaser version: latest - args: --rm-dist -f .github/conf/.goreleaser.yml + args: -f .github/conf/.goreleaser.yml workdir: . env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}