Skip to content

Commit

Permalink
Adding goreleaser config for binary release
Browse files Browse the repository at this point in the history
  • Loading branch information
garethjevans committed Jul 23, 2021
1 parent fe98f09 commit 66df33f
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: goreleaser

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build
dist
extracted*
51 changes: 51 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
env:
- GO111MODULE=on
- CGO_ENABLED=0

before:
hooks:
- go mod download

builds:
- id: bc-linux
main: ./cmd/main.go
binary: bc
ldflags:
- -X code.cloudfoundry.org/bosh-compile-action/pkg/version.Version={{.Version}} -X code.cloudfoundry.org/bosh-compile-action/pkg/version.Revision={{.ShortCommit}} -X code.cloudfoundry.org/bosh-compile-action/pkg/version.BuildDate={{.CommitDate}} -X code.cloudfoundry.org/bosh-compile-action/pkg/version.BuiltBy=goreleaser
goos:
- linux
goarch:
- amd64
- arm64
- s390x
- ppc64le

- id: bc-darwin
main: ./cmd/main.go
binary: bc
ldflags:
- -X code.cloudfoundry.org/bosh-compile-action/pkg/version.Version={{.Version}} -X code.cloudfoundry.org/bosh-compile-action/pkg/version.Revision={{.ShortCommit}} -X code.cloudfoundry.org/bosh-compile-action/pkg/version.BuildDate={{.CommitDate}} -X code.cloudfoundry.org/bosh-compile-action/pkg/version.BuiltBy=goreleaser
goos:
- darwin
goarch:
- amd64
- arm64

archives:
- name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
format_overrides:
- goos: windows
format: zip

checksum:
name_template: "{{ .ProjectName }}-checksums.txt"
algorithm: sha256

changelog:
skip: false

release:
draft: false
prerelease: false
name_template: "{{.Tag}}"

0 comments on commit 66df33f

Please sign in to comment.