Skip to content

Commit

Permalink
Use release-drafter and gorelease to release binaries
Browse files Browse the repository at this point in the history
Why?
- To have goreleaser do the heavy lifting
  • Loading branch information
oliver-hohn committed Apr 2, 2023
1 parent bd4dcfd commit 826caf0
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 83 deletions.
9 changes: 9 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# source: https://github.com/marketplace/actions/release-drafter#configuration
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&'
version-resolver:
default: minor
template: |
_No changelog for now!_
82 changes: 0 additions & 82 deletions .github/workflows/go.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# source: https://github.com/marketplace/actions/release-drafter
name: Release drafter

on:
push:
branches:
- main

permissions:
contents: read

jobs:
update_release_draft:
permissions:
contents: write
pull-requests: read
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
with:
disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# source: https://github.com/goreleaser/goreleaser-action
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.20


- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin/*/*
!bin/*/.keep
!bin/*/*/.keep
!bin/*/*/.keep
dist/
21 changes: 21 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# source: https://goreleaser.com
before:
hooks:
- go mod tidy
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
ldflags:
# source: https://goreleaser.com/customization/builds/#passing-environment-variables-to-ldflags
- -s -w -X "main.go={{.Version}}"
universal_binaries:
- replace: true
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"

0 comments on commit 826caf0

Please sign in to comment.