Skip to content

Commit

Permalink
Adds goreleaser support
Browse files Browse the repository at this point in the history
Added goreleaser support, both in distributions, and for this project
Fixes binenv specs accordingly
  • Loading branch information
leucos committed Aug 21, 2020
1 parent 6a1055c commit 0f06085
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 6 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/release_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release Go project

on:
push:
tags:
- "*" # triggers only if push new tag version, like `0.8.4` or else

jobs:
build:
name: GoReleaser build
runs-on: ubuntu-latest

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0 # See: https://goreleaser.com/ci/actions/

- name: Set up Go 1.15
uses: actions/setup-go@v2
with:
go-version: 1.15
id: go

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
binenv
*.json
/bin
/dist
34 changes: 34 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod download
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
# archives:
# - replacements:
# darwin: Darwin
# linux: Linux
# windows: Windows
# 386: i386
# amd64: x86_64
ldflags:
- -s -w -X github.com/devops-works/binenv/cmd.Version={{.Version}} -X github.com/devops-works/binenv/cmd.BuildDate={{.CommitDate}}
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ release: windows darwin linux ; $(info $(M) stripping release executable for Lin
# $Q gzip $(BIN)/$(PACKAGE)-win-amd64
$Q $(BIN)/$(PACKAGE) version

goreleaser-test: fmt lint clean ; $(info $(M) goreleaser dry-run…) @ ## Build program binary
goreleaser --snapshot --skip-publish --rm-dist



# don't even think about making a joke with this target name
prepush: outdated ; $(info $(M) execute CI linters…) @ ## execute linting tests so we should not fail liting in CI
Expand Down
24 changes: 20 additions & 4 deletions distributions/distributions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ sources:
- awless

binenv:
map:
windows: win
list:
type: github-releases
url: https://api.github.com/repos/devops-works/binenv/releases
fetch:
url: https://github.com/devops-works/binenv/releases/download/v{{ .Version }}/binenv-{{ .OS }}-{{ .Arch }}
install:
type: direct
type: tgz
binaries:
- "binenv{{ .ExeExtension }}"

cli53:
list:
type: github-releases
url: https://api.github.com/repos/barnybug/cli53/releases
fetch:
url: https://github.com/barnybug/cli53/releases/download/{{ .Version }}/cli53-{{ .OS }}-{{ .Arch }}{{ .ExeExtension }}
url: https://github.com/barnybug/cli53/releases/download/{{ .Version }}/cli53-{{ .OS }}-{{ .Arch }}.tar.gz
install:
type: direct

Expand Down Expand Up @@ -57,6 +57,22 @@ sources:
install:
type: direct

goreleaser:
map:
amd64: x86_64
darwin: Darwin
linux: Linux
windows: Windows
list:
type: github-releases
url: https://api.github.com/repos/goreleaser/goreleaser/releases
fetch:
url: https://github.com/goreleaser/goreleaser/releases/download/v{{ .Version }}/goreleaser_{{ .OS }}_{{ .Arch }}.tar.gz
install:
type: tgz
binaries:
- goreleaser

hugo:
map:
amd64: 64bit
Expand Down
2 changes: 0 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"github.com/devops-works/binenv/cmd"
)

var ()

func main() {
root := cmd.RootCmd()
root.Execute()
Expand Down

0 comments on commit 0f06085

Please sign in to comment.