diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f112e0a..2f95a08 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,6 +23,10 @@ jobs: with: go-version: '1.24' cache: true + - name: Install UPX + uses: crazy-max/ghaction-upx@v3 + with: + install-only: true # More assembly might be required: Docker logins, GPG, etc. It all depends # on your needs. - uses: goreleaser/goreleaser-action@v6 diff --git a/.github/workflows/trigger-nightly.yml b/.github/workflows/trigger-nightly.yml index 4fcc875..53bde40 100644 --- a/.github/workflows/trigger-nightly.yml +++ b/.github/workflows/trigger-nightly.yml @@ -3,7 +3,7 @@ name: Trigger nightly build on: schedule: # * is a special character in YAML, so you have to quote this string - - cron: '30 15 * * *' + - cron: '00 15 * * *' workflow_dispatch: jobs: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index ff657bc..f47074a 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -38,6 +38,67 @@ builds: ldflags: - "-s -w -X 'main.version={{ .Tag }}'" +upx: + - # Whether to enable it or not. + # + # Templates: allowed. + enabled: true + + # Filter by build ID. + # ids: [build1, build2] + + # Filter by GOOS. + goos: [linux] + + # Filter by GOARCH. + goarch: [arm, arm64, amd64] + + # Filter by GOARM. + # goarm: [8] + + # Filter by GOAMD64. + # goamd64: [v1] + + # Compress argument. + # Valid options are from '1' (faster) to '9' (better), and 'best'. + compress: best + + # Whether to try LZMA (slower). + lzma: true + + # Whether to try all methods and filters (slow). + brute: true + + - # Whether to enable it or not. + # + # Templates: allowed. + enabled: true + + # Filter by build ID. + # ids: [build1, build2] + + # Filter by GOOS. + goos: [windows] + + # Filter by GOARCH. + goarch: [amd64] + + # Filter by GOARM. + # goarm: [8] + + # Filter by GOAMD64. + # goamd64: [v1] + + # Compress argument. + # Valid options are from '1' (faster) to '9' (better), and 'best'. + compress: best + + # Whether to try LZMA (slower). + lzma: true + + # Whether to try all methods and filters (slow). + brute: true + archives: - format: tar.gz # use zip for windows archives diff --git a/Dockerfile b/Dockerfile index 0e9aab3..68af35a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,9 @@ FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.6.1 AS xx FROM --platform=$BUILDPLATFORM golang:1.24-alpine3.22 AS builder +# add upx for binary compression +RUN apk add --no-cache upx || echo "upx not found" + COPY --from=xx / / ARG TARGETPLATFORM @@ -17,8 +20,9 @@ WORKDIR /app COPY . . RUN cd cmd/gost && \ - xx-go build && \ - xx-verify gost + xx-go build -ldflags "-s -w" && \ + xx-verify gost && \ + { upx --best gost || true; } FROM alpine:3.22