From 2f27879b03b1e0f3743281c318e685dfc05ce6ca Mon Sep 17 00:00:00 2001 From: Jan Pieper Date: Thu, 31 Jul 2025 18:28:40 +0200 Subject: [PATCH] feat: build releases --- .github/workflows/release.yaml | 32 +++++++++++++++ .goreleaser.yaml | 71 ++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 .github/workflows/release.yaml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..d6762c1 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,32 @@ +name: Release + +on: + push: + tags: + - "*" + +jobs: + goreleaser: + name: GoReleaser + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Fetch all tags + run: git fetch --force --tags + - name: Setup Golang + uses: actions/setup-go@v5 + with: + go-version: 1.24.x + cache: false + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + version: '~> v2' + args: release --clean --timeout 5m + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..5fab9c2 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,71 @@ +version: 2 + +project_name: jm + +builds: + - id: jm + main: main.go + binary: jm + env: + - CGO_ENABLED=0 + flags: + - -v + ldflags: + - -X github.com/janpieper/jm/common.version={{ .Version }} + - -X github.com/janpieper/jm/common.buildDate={{ .Date }} + - -X github.com/janpieper/jm/common.gitCommit={{ .FullCommit }} + - -X github.com/janpieper/jm/common.gitTreeState={{ .GitTreeState }} + - -X github.com/janpieper/jm/common.gitTag={{ .Tag }} + - -extldflags="-static" + goos: + - linux + - windows + goarch: + - amd64 + - arm64 + ignore: + - goos: windows + goarch: s390x + - goos: windows + goarch: ppc64le + - goos: windows + goarch: arm64 + +archives: + - formats: [tar.gz] + name_template: |- + {{ .ProjectName }}-{{ .Os }}-{{ .Arch }} + +checksum: + name_template: checksums.txt + algorithm: sha256 + +changelog: + use: github + sort: asc + abbrev: 0 + groups: + - title: 'Breaking Changes' + regexp: '^.*?(\([[:word:]]+\))??!:.+$' + order: 0 + - title: 'Features' + regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$' + order: 100 + - title: 'Bug fixes' + regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$' + order: 200 + - title: 'Documentation' + regexp: '^.*?docs(\([[:word:]]+\))??!?:.+$' + order: 300 + - title: 'Other work' + order: 999 + filters: + exclude: + - '^test:' + - '(?i)bump' + +release: + prerelease: auto + draft: false + footer: | + **Full Changelog**: https://github.com/janpieper/jm/compare/{{ .PreviousTag }}...{{ .Tag }}