Skip to content

Commit

Permalink
Merge pull request #14 from sgsullivan/goreleaser
Browse files Browse the repository at this point in the history
Goreleaser
  • Loading branch information
sgsullivan committed Apr 30, 2021
2 parents 22abf48 + c509dfa commit fb663da
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/_exe
/local
/dist
39 changes: 39 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
project_name: befehl
before:
hooks:
- go mod verify
builds:
- env:
- CGO_ENABLED=0
main: cmd/main/main.go
goos:
- windows
- linux
- darwin
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
nfpms:
-
replacements:
amd64: x86_64
license: "Apache 2"
description: "Run arbitrary commands over ssh in mass"
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
formats:
- rpm
- deb
bindir: "/usr/local/bin"
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ test:

update-deps:
go get -u

release-build:
scripts/build/release-build
16 changes: 16 additions & 0 deletions scripts/build/.variables
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

unset LDFLAGS

GITCOMMIT=$(git rev-parse --short HEAD 2> /dev/null)
BUILDTIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")

latest_tag=$(git describe --abbrev=0 --tags)
gitcommit_match_tag=$(git describe --exact-match ${GITCOMMIT} 2> /dev/null)

if [[ "${gitcommit_match_tag}" == "${latest_tag}" ]]; then
VERSION=${latest_tag}
else
VERSION="${latest_tag}-dirty"
fi

6 changes: 6 additions & 0 deletions scripts/build/release-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

source scripts/build/.variables
set -e
VERSION=${VERSION} GITCOMMIT=${GITCOMMIT} BUILDTIME=${BUILDTIME} goreleaser --rm-dist
exit 0

0 comments on commit fb663da

Please sign in to comment.