From 4f265b76a87c3b330ff2d9474b8b2fde1444cd93 Mon Sep 17 00:00:00 2001 From: cn Date: Fri, 25 Jan 2019 10:39:09 +0100 Subject: [PATCH] module: add release instructions and script Using https://github.com/buildkite/github-release --- .gitignore | 1 + Makefile | 7 +++++++ README.md | 13 +++++++++++++ 3 files changed, 21 insertions(+) diff --git a/.gitignore b/.gitignore index f8a9ff9..091d00f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ cmd/miflorad/miflorad cmd/munin-miflora/munin-miflora cmd/munin-miflora-gatt/munin-miflora-gatt +pkg/miflorad-* diff --git a/Makefile b/Makefile index bbfc93a..93a2553 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,13 @@ remote-run: clean scp cmd/$(RUN_COMMAND)/$(RUN_COMMAND) extzero:$(RUN_COMMAND) ssh extzero "./$(RUN_COMMAND) $(RUN_OPTIONS)" +.PHONY: release +release: + mkdir -p pkg + cd cmd/miflorad && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "../../pkg/miflorad-$(MIFLORAD_VERSION)-linux-amd64" -ldflags="-s -w -X main.version=$(MIFLORAD_VERSION)" && cd ../.. + cd cmd/miflorad && CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -o "../../pkg/miflorad-$(MIFLORAD_VERSION)-linux-arm" -ldflags="-s -w -X main.version=$(MIFLORAD_VERSION)" && cd ../.. + github-release "v$(MIFLORAD_VERSION)" pkg/miflorad-$(MIFLORAD_VERSION)-* --commit "master" --tag "v$(MIFLORAD_VERSION)" --prerelease --github-repository "cmur2/miflorad" + .PHONY: cmd/miflorad/miflorad cmd/miflorad/miflorad: cd cmd/miflorad && CGO_ENABLED=0 go build -buildmode=pie -ldflags "-X main.version=$(MIFLORAD_VERSION)" && cd ../.. diff --git a/README.md b/README.md index f16be8b..a4f3916 100644 --- a/README.md +++ b/README.md @@ -48,3 +48,16 @@ handle = 0x0040, char properties = 0x02, char value handle = 0x0041, uuid = 0000 - [https://wiki.hackerspace.pl/projects:xiaomi-flora](https://wiki.hackerspace.pl/projects:xiaomi-flora) (very nice teardown) - [https://github.com/open-homeautomation/miflora](https://github.com/open-homeautomation/miflora) (python library) + +## Doing a release + +Install the [github-release binary](https://github.com/buildkite/github-release) helper somewhere into your path as `github-release`. + +You also need a [personal access token](https://github.com/settings/tokens) for your Github account. + +The below will create a Github release of `miflorad` based on your current git working copy and create a matching git tag: + +```bash +export GITHUB_RELEASE_ACCESS_TOKEN=my-personal-access-token +MIFLORAD_VERSION=x.y.z make release +```