Skip to content

Commit

Permalink
add goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
dcilke committed Apr 28, 2023
1 parent be2a6db commit 4d773e3
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 3 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: release

on:
push:
tags:
- "*"

permissions:
contents: write

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.20.3
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check formatting
run: make format
- name: Build
run: make build
- name: Test
run: make test
goreleaser:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.20.3
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: ${{ env.GITHUB_REF_NAME }}
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
28 changes: 28 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
builds:
- binary: hz
goos:
- darwin
- linux
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0
flags:
- -mod=mod

release:
prerelease: auto

universal_binaries:
- replace: true

brews:
- name: hz
homepage: "https://github.com/dcilke/hz"
tap:
owner: dcilke
name: homebrew-taps

checksum:
name_template: 'checksums.txt'
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ test: build-test
@go test -race ./... -timeout=30s -coverprofile=.covdata/coverage.out -covermode=atomic
@go tool cover -html=.covdata/coverage.out -o .covdata/coverage.html
@go tool cover -func=.covdata/coverage.out

.PHONY=format
format:
gofmt -l -s -w .
git status
git diff --exit-code
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/dcilke/hz

go 1.18
go 1.20

require (
github.com/dcilke/golden v0.1.0
Expand Down
2 changes: 0 additions & 2 deletions integration/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"testing"
)

const ()

var command string

func TestMain(m *testing.M) {
Expand Down

0 comments on commit 4d773e3

Please sign in to comment.