Skip to content

Commit 3a73e41

Browse files
ci: go releaser (#20)
Co-authored-by: Justin Tieri <[email protected]>
1 parent 51ecf47 commit 3a73e41

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# .github/workflows/release.yml
2+
name: goreleaser
3+
4+
on:
5+
pull_request:
6+
push:
7+
tags:
8+
- "*"
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
goreleaser:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: 1.21
26+
27+
- name: Run GoReleaser
28+
uses: goreleaser/goreleaser-action@v5
29+
with:
30+
distribution: goreleaser
31+
version: "~> v1"
32+
args: release --clean
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@
1919

2020
# Go workspace file
2121
go.work
22+
23+
dist/

.goreleaser.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
4+
# The lines below are called `modelines`. See `:help modeline`
5+
# Feel free to remove those if you don't want/need to use them.
6+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
7+
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
8+
9+
version: 1
10+
11+
before:
12+
hooks:
13+
- go mod tidy
14+
- go generate ./...
15+
16+
builds:
17+
- env:
18+
- CGO_ENABLED=0
19+
goos:
20+
- linux
21+
- windows
22+
- darwin
23+
goarch:
24+
- amd64
25+
- arm
26+
- arm64
27+
28+
archives:
29+
- format: tar.gz
30+
# this name template makes the OS and Arch compatible with the results of `uname`.
31+
name_template: >-
32+
{{ .ProjectName }}_
33+
{{- title .Os }}_
34+
{{- if eq .Arch "amd64" }}x86_64
35+
{{- else if eq .Arch "386" }}i386
36+
{{- else }}{{ .Arch }}{{ end }}
37+
{{- if .Arm }}v{{ .Arm }}{{ end }}
38+
# use zip for windows archives
39+
format_overrides:
40+
- goos: windows
41+
format: zip
42+
43+
changelog:
44+
use: github
45+
sort: asc
46+
groups:
47+
- title: Features
48+
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
49+
order: 0
50+
- title: "Bug fixes"
51+
regexp: '^.*?bug(\([[:word:]]+\))??!?:.+$'
52+
order: 1
53+
- title: Others
54+
order: 999
55+
56+
checksum:
57+
name_template: SHA256SUMS-{{.Version}}.txt
58+
algorithm: sha256
59+
60+
release:
61+
prerelease: auto
62+
draft: true
63+
64+
announce:
65+
slack:
66+
enabled: true
67+
message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}'
68+
channel: '#release-announce'
69+
username: 'SL Release Bot'
70+
icon_emoji: 'strangelove'

0 commit comments

Comments
 (0)