Skip to content

Commit

Permalink
Automate releases using GHA
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mumoshu committed Jan 10, 2024
1 parent f5cb542 commit db19498
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: echo "flags=--snapshot" >> $GITHUB_ENV
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20.12'
cache: true
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean ${{ env.flags }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 changes: 35 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
project_name: helm-diff
builds:
- id: default
main: .
binary: bin/diff
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -X github.com/databus23/helm-diff/v3/cmd.Version={{ .Version }}
goos:
- freebsd
- darwin
- linux
- windows
goarch:
- amd64
- arm64

archives:
- id: default
builds:
- default
format: tgz
name_template: '{{ .ProjectName }}-{{ if eq .Os "darwin" }}macos{{ else }}{{ .Os }}{{ end }}-{{ .Arch }}'
files:
- README.md
- plugin.yaml
- LICENSE
changelog:
use: github-native

release:
prerelease: auto

0 comments on commit db19498

Please sign in to comment.