Skip to content

Commit 169218c

Browse files
committed
ci(release): automate versioned builds with GoReleaser
1 parent fe28c90 commit 169218c

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
- uses: actions/setup-go@v4
16+
with:
17+
go-version: '1.24'
18+
- uses: goreleaser/goreleaser-action@v4
19+
with:
20+
distribution: goreleaser
21+
version: latest
22+
args: release --clean
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
CGO_ENABLED: 1

.goreleaser.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
2+
# GoReleaser config - v2 syntax
3+
4+
version: 2
5+
6+
before:
7+
hooks:
8+
- go mod tidy
9+
- go generate ./...
10+
11+
builds:
12+
- id: ghosttype
13+
main: ./main.go
14+
env:
15+
- CGO_ENABLED=1
16+
goos:
17+
- linux
18+
- darwin
19+
- windows
20+
goarch:
21+
- amd64
22+
- arm64
23+
ignore:
24+
- goos: linux
25+
goarch: "386"
26+
27+
archives:
28+
- id: ghosttype-archive
29+
builds:
30+
- ghosttype
31+
format: tar.gz
32+
wrap_in_directory: true
33+
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
34+
format_overrides:
35+
- goos: windows
36+
format: zip
37+
38+
changelog:
39+
sort: asc
40+
filters:
41+
exclude:
42+
- "^docs:"
43+
- "^test:"
44+
45+
checksum:
46+
name_template: 'checksums.txt'
47+
48+
release:
49+
github:
50+
owner: trknhr
51+
name: ghosttype
52+
draft: false
53+

0 commit comments

Comments
 (0)