Skip to content

Commit cb72f0b

Browse files
Add goreleaser
1 parent 346822b commit cb72f0b

4 files changed

Lines changed: 80 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
- run: git fetch --force --tags
19+
- uses: actions/setup-go@v3
20+
with:
21+
go-version: '>=1.20.1'
22+
cache: true
23+
- uses: goreleaser/goreleaser-action@v4
24+
with:
25+
distribution: goreleaser
26+
version: latest
27+
args: release --clean
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
/gen.go
2+
3+
dist/

.goreleaser.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
before:
4+
hooks:
5+
# You may remove this if you don't use go modules.
6+
- go mod tidy
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- windows
13+
- darwin
14+
ldflags:
15+
- -s -w -X main.build={{.Version}}
16+
17+
archives:
18+
- format: binary
19+
id: binary
20+
- format: tar.gz
21+
id: archive
22+
# this name template makes the OS and Arch compatible with the results of uname.
23+
name_template: >-
24+
{{ .ProjectName }}_
25+
{{- title .Os }}_
26+
{{- if eq .Arch "amd64" }}x86_64
27+
{{- else if eq .Arch "386" }}i386
28+
{{- else }}{{ .Arch }}{{ end }}
29+
{{- if .Arm }}v{{ .Arm }}{{ end }}
30+
# use zip for windows archives
31+
format_overrides:
32+
- goos: windows
33+
format: zip
34+
checksum:
35+
name_template: 'checksums.txt'
36+
snapshot:
37+
name_template: "{{ incpatch .Version }}-next"
38+
changelog:
39+
sort: asc
40+
filters:
41+
exclude:
42+
- '^docs:'
43+
- '^test:'
44+
45+
# The lines beneath this are called `modelines`. See `:help modeline`
46+
# Feel free to remove those if you don't want/use them.
47+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
48+
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.20
44

55
require (
66
github.com/dustin/go-humanize v1.0.1
7+
github.com/google/uuid v1.3.0
78
github.com/h2non/filetype v1.1.3
89
github.com/pterm/pterm v0.12.54
910
github.com/rs/zerolog v1.29.0
@@ -16,7 +17,6 @@ require (
1617
atomicgo.dev/keyboard v0.2.9 // indirect
1718
github.com/containerd/console v1.0.3 // indirect
1819
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
19-
github.com/google/uuid v1.3.0 // indirect
2020
github.com/gookit/color v1.5.2 // indirect
2121
github.com/lithammer/fuzzysearch v1.1.5 // indirect
2222
github.com/mattn/go-colorable v0.1.13 // indirect

0 commit comments

Comments
 (0)