Skip to content

Commit

Permalink
Add new github workflow to build release binaries (#696)
Browse files Browse the repository at this point in the history
* Add new github workflow to build release binaries

Use goreleaser to automatically build binaries for various platforms and
upload the binaries to the release.

* Fix goreleaser version

* Pin the goreleaser/goreleaser-action version
  • Loading branch information
adoy committed Sep 15, 2023
1 parent 3469147 commit 5b04fb5
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/release-binaries.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Monstache release binaries

on:
release:
types: [created]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v4
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@5fdedb94abba051217030cc86d4523cf3f02243d
with:
distribution: goreleaser
version: ~> 1.20
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ _testmain.go

# Swap files
*.swp

dist/
38 changes: 38 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
before:
hooks:
- go mod download
builds:
- id: monstache
binary: monstache
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
archives:
- id: monstache-archive
name_template: |-
monstache_{{ .Tag }}_{{ .Os }}_
{{- with .Arch -}}
{{- if (eq . "amd64") -}}x86_64
{{- else -}}{{- . -}}
{{- end -}}
{{ end }}
{{- with .Arm -}}
{{- if (eq . "6") -}}hf
{{- else -}}v{{- . -}}
{{- end -}}
{{- end -}}
builds:
- monstache
format_overrides:
- goos: windows
format: zip
files: ["LICENSE"]
checksum:
name_template: "checksums.txt"
algorithm: sha256

0 comments on commit 5b04fb5

Please sign in to comment.