Skip to content

Commit e5a6cc6

Browse files
committed
ci: handle releases with goreleaser
1 parent 70c6ef2 commit e5a6cc6

File tree

4 files changed

+63
-27
lines changed

4 files changed

+63
-27
lines changed

.github/workflows/release.yml

+25-26
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
1-
name: Release Binaries
1+
name: goreleaser
2+
23
on:
3-
release:
4-
types: [created]
4+
pull_request:
5+
push:
6+
# run only against tags
7+
tags:
8+
- "v*"
59

610
permissions:
7-
contents: write
8-
packages: write
11+
contents: write
912

1013
jobs:
11-
releases-matrix:
12-
name: Release Go Binary
13-
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
17-
goos: [linux, windows, darwin]
18-
goarch: ["386", amd64, arm64]
19-
exclude:
20-
- goarch: "386"
21-
goos: darwin
22-
23-
steps:
24-
- uses: actions/checkout@v4
25-
- uses: wangyoucao577/go-release-action@v1
26-
with:
27-
github_token: ${{ secrets.GITHUB_TOKEN }}
28-
goos: ${{ matrix.goos }}
29-
goarch: ${{ matrix.goarch }}
30-
goversion: 1.22
31-
extra_files: LICENSE README.md
14+
goreleaser:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- name: Setup Go
22+
uses: actions/setup-go@v4
23+
with:
24+
go-version: 1.22.x
25+
- name: Run goreleaser
26+
uses: goreleaser/goreleaser-action@v4
27+
with:
28+
args: release --clean
29+
env:
30+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ repl-result-*
1414
# docs
1515
node_modules
1616
docs/.vitepress/cache
17-
docs/.vitepress/dist
17+
docs/.vitepress/dist
18+
19+
# goreleaser
20+
dist/

.goreleaser.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
project_name: treefmt
12+
13+
before:
14+
hooks:
15+
- go mod tidy
16+
17+
builds:
18+
- env:
19+
- CGO_ENABLED=0
20+
ldflags:
21+
- -s -w -X git.numtide.com/numtide/treefmt/build.Version=v{{.Version}}
22+
goos:
23+
- linux
24+
- darwin
25+
26+
changelog:
27+
sort: asc
28+
use: github
29+
filters:
30+
exclude:
31+
- "^chore:"
32+
- "^docs:"
33+
- "^test:"

nix/devshell.nix

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
(with pkgs; [
2828
# golang
2929
go
30+
goreleaser
3031
delve
3132
pprof
3233
graphviz

0 commit comments

Comments
 (0)