Skip to content

Commit

Permalink
Add new github workflow to build release binaries
Browse files Browse the repository at this point in the history
Use goreleaser to automatically build binaries for various platforms and
upload the binaries to the release.
  • Loading branch information
adoy committed Sep 11, 2023
1 parent 3469147 commit c03fb12
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@v4
with:
distribution: goreleaser
version: latest
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 c03fb12

Please sign in to comment.