diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 61b52da..b8ea3c8 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -6,6 +6,8 @@ name: Go on: push: branches: ["main"] + tags: + - "v*" pull_request: branches: ["main"] @@ -25,3 +27,13 @@ jobs: - name: Test run: go test -v ./... + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + if: success() && startsWith(github.ref, 'refs/tags/') + with: + distribution: goreleaser + version: "~> v2" + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index a4d5545..f014bc6 100644 --- a/.gitignore +++ b/.gitignore @@ -205,4 +205,5 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk -# End of https://www.toptal.com/developers/gitignore/api/macos,windows,linux,intellij+all,visualstudiocode,go \ No newline at end of file +# End of https://www.toptal.com/developers/gitignore/api/macos,windows,linux,intellij+all,visualstudiocode,go +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..2b87a9a --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,36 @@ +version: 2 + +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + +archives: + - format: tar.gz + # this name template makes the OS and Arch compatible with the results of `uname`. + 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 }} + # use zip for windows archives + format_overrides: + - goos: windows + format: zip + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:"