From e69d8c8bbf21955b40100a2e47d3888d9d57fe05 Mon Sep 17 00:00:00 2001 From: Kevin Franklin Kim Date: Fri, 7 Jan 2022 14:27:37 +0100 Subject: [PATCH] chore: update goreleaser --- .github/workflows/release.yml | 16 +++++++---- .goreleaser.yml | 8 ++++-- Makefile | 53 +++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 76956e4..4636731 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,25 +3,31 @@ name: goreleaser on: push: tags: - - '*' + - v*.*.* jobs: goreleaser: runs-on: ubuntu-latest + env: + GOFLAGS: -mod=readonly + GOPROXY: https://proxy.golang.org steps: - name: Checkout uses: actions/checkout@v2 + - name: Unshallow run: git fetch --prune --unshallow + - name: Set up Go - uses: actions/setup-go@v1 + uses: actions/setup-go@v2 with: - go-version: 1.14.x + go-version: 1.16 + - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v1 + uses: goreleaser/goreleaser-action@v2 with: + distribution: goreleaser version: latest args: release --rm-dist - key: ${{ secrets.YOUR_PRIVATE_KEY }} env: GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 81f0538..c59d824 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -3,14 +3,18 @@ builds: main: ./cmd/cli/logfrog.go env: - CGO_ENABLED=0 - ldflags: - - -s -w -X main.version={{.Version}} goos: - darwin - linux goarch: - amd64 - arm64 + goarm: + - "7" + flags: + - -trimpath + ldflags: + - -s -w -X main.version={{.Version}} archives: - format: tar.gz diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5a4683d --- /dev/null +++ b/Makefile @@ -0,0 +1,53 @@ +.DEFAULT_GOAL:=help + +## === Tasks === + +## Install binary +install: + go build -o ${GOPATH}/bin/stern main.go + +## Build binary +build: + goreleaser build --rm-dist --snapshot + +.PHONY: test +## Run tests +test: + go test ./... + +release: + goreleaser --rm-dist + +## === Utils === + +## Show help text +help: + @awk '{ \ + if ($$0 ~ /^.PHONY: [a-zA-Z\-\_0-9]+$$/) { \ + helpCommand = substr($$0, index($$0, ":") + 2); \ + if (helpMessage) { \ + printf "\033[36m%-23s\033[0m %s\n", \ + helpCommand, helpMessage; \ + helpMessage = ""; \ + } \ + } else if ($$0 ~ /^[a-zA-Z\-\_0-9.]+:/) { \ + helpCommand = substr($$0, 0, index($$0, ":")); \ + if (helpMessage) { \ + printf "\033[36m%-23s\033[0m %s\n", \ + helpCommand, helpMessage"\n"; \ + helpMessage = ""; \ + } \ + } else if ($$0 ~ /^##/) { \ + if (helpMessage) { \ + helpMessage = helpMessage"\n "substr($$0, 3); \ + } else { \ + helpMessage = substr($$0, 3); \ + } \ + } else { \ + if (helpMessage) { \ + print "\n "helpMessage"\n" \ + } \ + helpMessage = ""; \ + } \ + }' \ + $(MAKEFILE_LIST)