From 10dfd55ce54cfa54b4f6ec7794c56f62e7f89924 Mon Sep 17 00:00:00 2001 From: Dominik Roos Date: Fri, 16 Jun 2023 21:25:43 +0200 Subject: [PATCH] release: add goreleaser configuration (#17) --- .github/workflows/release.yml | 29 ++++++++++++++++++++++ .gitignore | 2 ++ .goreleaser.yaml | 45 +++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b335fdf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: goreleaser + +on: + push: + tags: + - "*" + +permissions: + contents: write + packages: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - uses: actions/setup-go@v4 + with: + go-version: stable + - uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 3afccaa..6c2360f 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ # Dependency directories (remove the comment below to include it) # vendor/ + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..dde9f49 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,45 @@ +before: + hooks: + - go mod tidy +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + ignore: + - goos: windows + goarch: "386" + main: ./cmd/old-man-yells-at + +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 +checksum: + name_template: "checksums.txt" +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + use: github-native + filters: + exclude: + - "^docs:" + - "^test:" +gomod: + proxy: true + env: + - GOPROXY=https://proxy.golang.org,direct + - GOSUMDB=sum.golang.org