diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..41c6f3a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: goreleaser + +on: + push: + # run only against tags + tags: + - "*" + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: stable + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: "~> v1" + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 78de5f6..5fe268a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,9 @@ att examples/ +# Added by goreleaser init: +dist/ + ### Go ### # Binaries for programs and plugins *.exe diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..21b29ba --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,36 @@ +# Documentation at https://goreleaser.com + +version: 2 + +before: + hooks: + - go mod tidy + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - 386 + +archives: + - format: zip + + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" diff --git a/Makefile b/Makefile index 3401cde..a3dab4d 100644 --- a/Makefile +++ b/Makefile @@ -20,4 +20,9 @@ clean: @rm -f main @rm -rf coverage.out -.PHONY: build run test clean +release: + @echo "Building release with goreleaser locally..." + @goreleaser check + @goreleaser release --snapshot --clean + +.PHONY: build run test covera clean release