Skip to content

Commit b3cae52

Browse files
committed
feat(build): workflow to have binaries on releases
- Fixes #294
1 parent 005c0c8 commit b3cae52

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

.github/workflows/build.yml

+15
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ jobs:
9595
runs-on: ubuntu-latest
9696
steps:
9797
- uses: actions/checkout@v3
98+
with:
99+
fetch-depth: 0 # for gorelease last step
98100

99101
# extract metadata (tags, labels) for Docker
100102
# https://github.com/docker/metadata-action
@@ -146,3 +148,16 @@ jobs:
146148
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
147149
tags: ${{ steps.meta.outputs.tags }}
148150
push: true
151+
152+
- if: github.event_name == 'release'
153+
uses: actions/setup-go@v2
154+
with:
155+
go-version: 1.21
156+
157+
- if: github.event_name == 'release'
158+
uses: goreleaser/goreleaser-action@v5
159+
with:
160+
version: latest
161+
args: release --clean --config .gorelease.yml
162+
env:
163+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gorelease.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
before:
2+
hooks:
3+
- go mod download
4+
builds:
5+
- main: ./cmd/updater/main.go
6+
flags:
7+
- -trimpath
8+
ldflags:
9+
- -s -w
10+
env:
11+
- CGO_ENABLED=0
12+
targets:
13+
# See https://goreleaser.com/customization/build/
14+
- linux_amd64
15+
- linux_386
16+
- linux_arm64
17+
- linux_arm_7
18+
- linux_arm_6
19+
- linux_arm_5
20+
- darwin_amd64
21+
- darwin_arm64
22+
- windows_amd64
23+
- windows_386
24+
- windows_arm64
25+
archives:
26+
- format: binary
27+
checksum:
28+
name_template: "checksums.txt"
29+
snapshot:
30+
name_template: "{{ .Tag }}-next"
31+
changelog:
32+
sort: asc

0 commit comments

Comments
 (0)