Skip to content

Commit db19498

Browse files
committed
Automate releases using GHA
To publish a release, we currently have to run `make docker-run-release` locally after tagging a release, which is not a huge effort but a bit cumbersome, because we do it only a few times a year and that is long enough to lose my memory :) Starting this change, we use a GHA workflow to automatically build and publish binaries whenever a new semver tag is created, so that we do not need to run `make` anymore.
1 parent f5cb542 commit db19498

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

.github/workflows/release.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
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+
-
16+
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
17+
run: echo "flags=--snapshot" >> $GITHUB_ENV
18+
-
19+
name: Checkout
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
-
24+
name: Set up Go
25+
uses: actions/setup-go@v4
26+
with:
27+
go-version: '1.20.12'
28+
cache: true
29+
-
30+
name: Run GoReleaser
31+
uses: goreleaser/goreleaser-action@v4
32+
with:
33+
distribution: goreleaser
34+
version: latest
35+
args: release --clean ${{ env.flags }}
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
project_name: helm-diff
2+
builds:
3+
- id: default
4+
main: .
5+
binary: bin/diff
6+
env:
7+
- CGO_ENABLED=0
8+
flags:
9+
- -trimpath
10+
ldflags:
11+
- -X github.com/databus23/helm-diff/v3/cmd.Version={{ .Version }}
12+
goos:
13+
- freebsd
14+
- darwin
15+
- linux
16+
- windows
17+
goarch:
18+
- amd64
19+
- arm64
20+
21+
archives:
22+
- id: default
23+
builds:
24+
- default
25+
format: tgz
26+
name_template: '{{ .ProjectName }}-{{ if eq .Os "darwin" }}macos{{ else }}{{ .Os }}{{ end }}-{{ .Arch }}'
27+
files:
28+
- README.md
29+
- plugin.yaml
30+
- LICENSE
31+
changelog:
32+
use: github-native
33+
34+
release:
35+
prerelease: auto

0 commit comments

Comments
 (0)