Skip to content

Commit 79f29ec

Browse files
author
Leandro Ferreira
committed
update .goreleaser
1 parent 91d04ec commit 79f29ec

File tree

2 files changed

+109
-69
lines changed

2 files changed

+109
-69
lines changed

.github/workflows/goreleaser.yml

Lines changed: 61 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,64 @@
1-
name: goreleaser
1+
version: 2
22

3-
on:
4-
push:
5-
tags:
6-
- "*"
3+
before:
4+
hooks:
5+
- go mod tidy
6+
- go generate ./...
77

8-
permissions:
9-
contents: write
8+
builds:
9+
- id: build-linux-windows
10+
goos:
11+
- windows
12+
- linux
13+
goarch:
14+
- amd64
15+
- arm64
16+
env:
17+
- CGO_ENABLED=0
18+
flags:
19+
- -trimpath
20+
when:
21+
env:
22+
BUILD_TARGET: linux-windows
1023

11-
jobs:
12-
goreleaser:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v4
17-
with:
18-
fetch-depth: 0
19-
- name: Set up Go
20-
uses: actions/setup-go@v5
21-
- name: Run GoReleaser
22-
uses: goreleaser/goreleaser-action@v6
23-
with:
24-
distribution: goreleaser
25-
version: "~> v2"
26-
args: release --clean
27-
env:
28-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
- id: build-macos
25+
goos:
26+
- darwin
27+
goarch:
28+
- amd64
29+
- arm64
30+
env:
31+
- CGO_ENABLED=1
32+
flags:
33+
- -trimpath
34+
when:
35+
env:
36+
BUILD_TARGET: macos
37+
38+
archives:
39+
- format: tar.gz
40+
name_template: >-
41+
{{ .ProjectName }}_
42+
{{- title .Os }}_
43+
{{- if eq .Arch "amd64" }}x86_64
44+
{{- else if eq .Arch "386" }}i386
45+
{{- else }}{{ .Arch }}{{ end }}
46+
{{- if .Arm }}v{{ .Arm }}{{ end }}
47+
format_overrides:
48+
- goos: windows
49+
format: zip
50+
51+
changelog:
52+
sort: asc
53+
filters:
54+
exclude:
55+
- "^docs:"
56+
- "^test:"
57+
58+
checksum:
59+
name_template: "checksums.txt"
60+
61+
release:
62+
github:
63+
owner: leandrodaf
64+
name: Pianalyze

.goreleaser.yaml

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,52 @@
1-
version: 2
1+
name: goreleaser
22

3-
before:
4-
hooks:
5-
- go mod tidy
6-
- go generate ./...
3+
on:
4+
push:
5+
tags:
6+
- "*"
77

8-
builds:
9-
- env:
10-
- CGO_ENABLED=0
11-
goos:
12-
- linux
13-
- windows
14-
- darwin
15-
goarch:
16-
- amd64
17-
- arm64
8+
permissions:
9+
contents: write
1810

19-
archives:
20-
- format: tar.gz
21-
name_template: >-
22-
{{ .ProjectName }}_
23-
{{- title .Os }}_
24-
{{- if eq .Arch "amd64" }}x86_64
25-
{{- else if eq .Arch "386" }}i386
26-
{{- else }}{{ .Arch }}{{ end }}
27-
{{- if .Arm }}v{{ .Arm }}{{ end }}
28-
format_overrides:
29-
- goos: windows
30-
format: zip
11+
jobs:
12+
build-linux-windows:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: '1.23'
23+
- name: Run GoReleaser for Linux and Windows
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
BUILD_TARGET: linux-windows
27+
uses: goreleaser/goreleaser-action@v6
28+
with:
29+
distribution: goreleaser
30+
version: "~> v2"
31+
args: release --clean --skip=publish,validate
3132

32-
changelog:
33-
sort: asc
34-
filters:
35-
exclude:
36-
- "^docs:"
37-
- "^test:"
38-
39-
checksum:
40-
name_template: "checksums.txt"
41-
42-
snapshot:
43-
name_template: "{{ .Tag }}-{{ .ShortCommit }}"
44-
45-
release:
46-
github:
47-
owner: leandrodaf
48-
name: Pianalyze
33+
build-macos:
34+
runs-on: macos-latest
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
- name: Set up Go
41+
uses: actions/setup-go@v5
42+
with:
43+
go-version: '1.23'
44+
- name: Run GoReleaser for macOS
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
BUILD_TARGET: macos
48+
uses: goreleaser/goreleaser-action@v6
49+
with:
50+
distribution: goreleaser
51+
version: "~> v2"
52+
args: release --clean --skip=publish,validate

0 commit comments

Comments
 (0)