From 5b5c76551aecdc942ec9ecd5ab60a63faaa0b7ab Mon Sep 17 00:00:00 2001 From: James Mills Date: Mon, 31 Dec 2018 19:01:04 +1000 Subject: [PATCH] Add goreleaser config --- .goreleaser.yml | 21 +++++++++++++++++++++ scripts/release.sh | 43 ------------------------------------------- 2 files changed, 21 insertions(+), 43 deletions(-) create mode 100644 .goreleaser.yml delete mode 100755 scripts/release.sh diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..255cee9 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,21 @@ +builds: + - main: . + binary: shorturl + flags: -tags "static_build" + ldflags: -w -X shorturl.Version={{.Version}} -X shorturl.Commit={{.Commit}} + env: + - CGO_ENABLED=0 + goos: + - darwin + - freebsd + - linux + goarch: + - i386 + - amd64 + - arm + - amd64 + goarm: + - 6 + - 7 +sign: + artifacts: checksum diff --git a/scripts/release.sh b/scripts/release.sh deleted file mode 100755 index 051a0b7..0000000 --- a/scripts/release.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -echo -n "Version to tag: " -read TAG - -echo -n "Name of release: " -read NAME - -echo -n "Desc of release: " -read DESC - -git tag ${TAG} -git push --tags - -if [ ! -d ./bin ]; then - mkdir bin -else - rm -rf ./bin/* -fi - -echo -n "Building binaries ... " - -rice embed-go - -GOOS=linux GOARCH=amd64 go build -o ./bin/shorturl-Linux-x86_64 . -GOOS=linux GOARCH=arm64 go build -o ./bin/shorturl-Linux-x86_64 . -GOOS=darwin GOARCH=amd64 go build -o ./bin/shorturl-Darwin-x86_64 . -GOOS=windows GOARCH=amd64 go build -o ./bin/shorturl-Windows-x86_64.exe . - -echo "DONE" - -echo -n "Uploading binaries ... " - -github-release release \ - -u prologic -p -r shorturl \ - -t ${TAG} -n "${NAME}" -d "${DESC}" - -for file in bin/*; do - name="$(echo $file | sed -e 's|bin/||g')" - github-release upload -u prologic -r shorturl -t ${TAG} -n $name -f $file -done - -echo "DONE"