From c5e220eda4c76033e309b02ed58d4887befc3a8c Mon Sep 17 00:00:00 2001 From: "Andrew E. Bruno" Date: Tue, 4 Dec 2018 20:04:37 -0500 Subject: [PATCH] Add release building --- CHANGELOG.md | 8 ++++++++ go.sum | 1 + main.go | 6 +++++- scripts/make-release.sh | 24 ++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md create mode 100755 scripts/make-release.sh diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d214910 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# myoxi Changelog + +## [0.0.1] - 2018-12-04 + +- Initial release + +[Unreleased]: https://github.com/aebruno/myoxi/compare/v0.0.1...HEAD +[0.0.1]: https://github.com/aebruno/myoxi/releases/tag/v0.0.1 diff --git a/go.sum b/go.sum index 37f72c1..96172d7 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,7 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA= github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e h1:9MlwzLdW7QSDrhDjFlsEYmxpFyIoXmYRon3dt0io31k= diff --git a/main.go b/main.go index 6c6b4b6..97267e2 100644 --- a/main.go +++ b/main.go @@ -30,6 +30,10 @@ import ( "github.com/urfave/cli" ) +var ( + MyoxiVersion = "dev" +) + func connectDevice(port string) (device.Device, error) { log.Infof("Using device port: %s", port) @@ -108,7 +112,7 @@ func main() { app.Name = "myoxi" app.Authors = []cli.Author{cli.Author{Name: "Andrew E. Bruno", Email: "aeb@qnot.org"}} app.Usage = "myoxi" - app.Version = "0.0.1" + app.Version = MyoxiVersion app.Flags = []cli.Flag{ &cli.BoolFlag{Name: "debug,d", Usage: "Print debug messages"}, &cli.StringFlag{Name: "port, p", Usage: "Path to device port", Value: "/dev/ttyUSB0"}, diff --git a/scripts/make-release.sh b/scripts/make-release.sh new file mode 100755 index 0000000..7c07b69 --- /dev/null +++ b/scripts/make-release.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +MYOXI_DIR='./.myoxi-release' +VERSION=`git describe --long --tags --dirty --always | sed -e 's/^v//'` +for os in linux windows +do + for arch in amd64 386 + do + rm -Rf ${MYOXI_DIR} + GOOS=$os GOARCH=$arch go build -ldflags "-X main.MyoxiVersion=$VERSION" . + + NAME=myoxi-${VERSION}-${os}-${arch} + REL_DIR=${MYOXI_DIR}/${NAME} + mkdir -p ${REL_DIR} + cp ./myoxi* ${REL_DIR}/ + cp ./README.md ${REL_DIR}/ + cp ./CHANGELOG.md ${REL_DIR}/ + cp ./LICENSE ${REL_DIR}/ + cd ${MYOXI_DIR} && zip -r ../${NAME}.zip ${NAME} + cd .. + rm -Rf ${MYOXI_DIR} + rm -f myoxi myoxi.exe + done +done