From c75074777c5a7f9acc8c55b5018b5853d4cb2f66 Mon Sep 17 00:00:00 2001 From: Jerry Jacobs Date: Fri, 26 Jul 2024 21:05:11 +0200 Subject: [PATCH] Extend goreleaser build targets --- .github/workflows/build.yml | 6 +++--- .goreleaser.yaml | 16 +++++++++++++++- Makefile | 14 +++++++------- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d06512d..8d9cb20 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,8 +51,8 @@ jobs: path: | dist - release-dll: - name: Build release DLL + goreleaser: + name: Build releases with goreleaser environment: prod runs-on: ubuntu-latest steps: @@ -83,7 +83,7 @@ jobs: filename: "ssh_private_key" working-directory: "./resources" - - name: Run GoReleaser to build release DLL + - name: Run GoReleaser to build releases uses: goreleaser/goreleaser-action@v6 with: # either 'goreleaser' (default) or 'goreleaser-pro' diff --git a/.goreleaser.yaml b/.goreleaser.yaml index cf1165e..2607b1a 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -16,7 +16,7 @@ before: - go generate ./... builds: - - id: "dll" + - id: "win-amd64-dll-release" env: - CGO_ENABLED=1 - CC=x86_64-w64-mingw32-gcc @@ -33,6 +33,20 @@ builds: - release - dll + - id: "release" + env: + - CGO_ENABLED=0 + goos: + - darwin + - linux + - windows + goarch: + - amd64 + - arm64 + gobinary: "scripts/garble-literals.sh" + tags: + - release + archives: - format: tar.gz # this name template makes the OS and Arch compatible with the results of `uname`. diff --git a/Makefile b/Makefile index b9d4035..348db13 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ SOURCES=Makefile main.go main_release.go main_debug.go config.go config_release.go config_template.go -GARBLE_BIN = $(shell go env GOPATH)/bin/garble -literals +GARBLE_BIN = $(shell go env GOPATH)/bin/garble +GARBLE_CMD = $(GARBLE_BIN) -literals all: socks5-ssh-proxy @@ -14,14 +15,13 @@ test-release: socks5-ssh-proxy.release ./socks5-ssh-proxy.release socks5-ssh-proxy: $(SOURCES) go build -o $@ -socks5-ssh-proxy.release: resources $(SOURCES) - GOOS=darwin GOARCH=amd64 $(GO_ENV_VARS) go build -tags release -o $@ +socks5-ssh-proxy.release: resources $(SOURCES) $(GARBLE_BIN) + GOOS=darwin GOARCH=amd64 $(GARBLE_CMD) build -tags release -o $@ upx $@ win: socks5-ssh-proxy.exe -socks5-ssh-proxy.exe: resources $(SOURCES) - GOOS=windows GOARCH=amd64 $(GARBLE_BIN) build -ldflags -H=windowsgui -tags release -o $@ -dll: resources - rm -Rf dist +socks5-ssh-proxy.exe: resources $(GARBLE_BIN) $(SOURCES) + GOOS=windows GOARCH=amd64 $(GARBLE_CMD) build -ldflags -H=windowsgui -tags release -o $@ +goreleaser: resources $(GARBLE_BIN) goreleaser build --snapshot win-package: ChromeProxyHelperPlugin.zip ChromeProxyHelperPlugin.zip: socks5-ssh-proxy.exe