Skip to content

Commit

Permalink
update .goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
Leandro Ferreira committed Oct 26, 2024
1 parent 91d04ec commit 79f29ec
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 69 deletions.
86 changes: 61 additions & 25 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,64 @@
name: goreleaser
version: 2

on:
push:
tags:
- "*"
before:
hooks:
- go mod tidy
- go generate ./...

permissions:
contents: write
builds:
- id: build-linux-windows
goos:
- windows
- linux
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0
flags:
- -trimpath
when:
env:
BUILD_TARGET: linux-windows

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
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: build-macos
goos:
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=1
flags:
- -trimpath
when:
env:
BUILD_TARGET: macos

archives:
- format: tar.gz
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 }}
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

checksum:
name_template: "checksums.txt"

release:
github:
owner: leandrodaf
name: Pianalyze
92 changes: 48 additions & 44 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,52 @@
version: 2
name: goreleaser

before:
hooks:
- go mod tidy
- go generate ./...
on:
push:
tags:
- "*"

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
permissions:
contents: write

archives:
- format: tar.gz
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 }}
format_overrides:
- goos: windows
format: zip
jobs:
build-linux-windows:
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: '1.23'
- name: Run GoReleaser for Linux and Windows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_TARGET: linux-windows
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean --skip=publish,validate

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

checksum:
name_template: "checksums.txt"

snapshot:
name_template: "{{ .Tag }}-{{ .ShortCommit }}"

release:
github:
owner: leandrodaf
name: Pianalyze
build-macos:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Run GoReleaser for macOS
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_TARGET: macos
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean --skip=publish,validate

0 comments on commit 79f29ec

Please sign in to comment.