Skip to content

Commit

Permalink
chore: update goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinkim committed Jan 7, 2022
1 parent 97f691b commit e69d8c8
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 7 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
8 changes: 6 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
53 changes: 53 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit e69d8c8

Please sign in to comment.