Skip to content

Commit d62e364

Browse files
authored
Automate releases using GHA (#517)
* 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. * Applies bonddim's suggestion. Thx! * We do have to wrap files in the diff dir. See #480 (comment)
1 parent f5cb542 commit d62e364

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-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-file: 'go.mod'
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: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# To test this manually, run:
2+
# go install github.com/goreleaser/goreleaser@latest
3+
# goreleaser --snapshot --clean
4+
# for f in dist/helm-diff*.tgz; do echo Testing $f...; tar tzvf $f; done
5+
project_name: helm-diff
6+
builds:
7+
- id: default
8+
main: .
9+
binary: bin/diff
10+
env:
11+
- CGO_ENABLED=0
12+
flags:
13+
- -trimpath
14+
ldflags:
15+
- -X github.com/databus23/helm-diff/v3/cmd.Version={{ .Version }}
16+
goos:
17+
- freebsd
18+
- darwin
19+
- linux
20+
- windows
21+
goarch:
22+
- amd64
23+
- arm64
24+
25+
archives:
26+
- id: default
27+
builds:
28+
- default
29+
format: tgz
30+
name_template: '{{ .ProjectName }}-{{ if eq .Os "darwin" }}macos{{ else }}{{ .Os }}{{ end }}-{{ .Arch }}'
31+
wrap_in_directory: diff
32+
files:
33+
- README.md
34+
- plugin.yaml
35+
- LICENSE
36+
changelog:
37+
use: github-native
38+
39+
release:
40+
prerelease: auto

0 commit comments

Comments
 (0)