diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4b2bcd1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,27 @@ +name: goreleaser + +on: + push: + tags: + - "v*.*.*" + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.23" + - name: Run GoReleaser + uses: goreleaser/goreleaser-action + with: + distribution: goreleaser + version: ${{ env.GITHUB_REF_NAME }} + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 631b294..b7a602d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ # deploy/ id_ed25* id_ed25519* +# Added by goreleaser init: +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..bb74a96 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,54 @@ +version: 2 + +before: + hooks: + - go mod tidy + - go generate ./... + +builds: + - env: + - CGO_ENABLED=0 + main: ./cmd + goos: + - linux + - windows + - darwin + + goarch: + - amd64 + - arm64 + + ldflags: + - -s -w -X github.com/ayinke-llc/sdump.Version={{.Version}} + +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:" + +release: + footer: >- + + --- + + Released by [GoReleaser](https://github.com/goreleaser/goreleaser). + +checksum: + name_template: "checksums.txt"