From 0cf8b8c180fcf45f77ae48b3b2a15b3245409c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=B1=E8=88=9E=E8=80=85?= Date: Tue, 14 Nov 2023 23:06:49 +0800 Subject: [PATCH] Update --- .github/conf/.goreleaser.yml | 79 +++++++++++++++-------------------- .github/workflows/release.yml | 28 ++++++++----- 2 files changed, 51 insertions(+), 56 deletions(-) diff --git a/.github/conf/.goreleaser.yml b/.github/conf/.goreleaser.yml index 02d2a38c..3444d0f2 100644 --- a/.github/conf/.goreleaser.yml +++ b/.github/conf/.goreleaser.yml @@ -1,69 +1,54 @@ before: hooks: - - sudo apt -y install libprotobuf-dev protobuf-compiler protoc-gen-go - go mod tidy - - go generate ./... builds: - - id: "with-upx" + - + id: default env: - CGO_ENABLED=0 goos: - - linux - windows + - linux - darwin + - freebsd goarch: - amd64 - - arm64 - - arm - "386" - 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: 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 - - darwin - goarch: - - mips64 - arm + - arm64 + - mips + - mipsle + - mips64 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 - - + - -s -w +upx: + - + ids: [ default ] + enabled: true + goos: ["windows", "linux"] + goarch: ["amd64", "386"] + compress: best + lzma: true + brute: true archives: - - replacements: - darwin: Darwin - linux: Linux - windows: Windows - 386: i386 - amd64: x86_64 + - + format: binary + allow_different_binary_count: true + name_template: >- + {{- .ProjectName }} + {{- if eq .Os "darwin"}}_mac + {{- else if eq .Os "linux"}} + {{- else if eq .Os "windows"}} + {{- else }}_{{ .Os }}{{ end }} + {{- if eq .Arch "amd64" }} + {{- else if eq .Arch "386" }}32 + {{- else }}_{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end -}} checksum: name_template: 'checksums.txt' snapshot: @@ -74,3 +59,5 @@ changelog: exclude: - '^docs:' - '^test:' + - "^*.md" + - "^*.ya?ml" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c9a5ee90..c42bd7ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,23 +13,31 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 steps: - - - name: Checkout - uses: actions/checkout@v2 + - name: "Check out code" + uses: actions/checkout@v3 with: fetch-depth: 0 + + - name: "Set up Go" + uses: actions/setup-go@v4 + with: + go-version: 1.21.x - - name: Set up Go - uses: actions/setup-go@v2 + name: Install UPX + uses: crazy-max/ghaction-upx@v3 with: - go-version: 1.19 + install-only: true + + - name: UPX version + run: upx --version + - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 + name: "Create release on GitHub" + uses: goreleaser/goreleaser-action@v4 with: distribution: goreleaser version: latest - args: -f .github/conf/.goreleaser.yml + args: "release --clean --debug -f .github/conf/.goreleaser.yml" workdir: . env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file