diff --git a/Makefile b/Makefile index 9f04494a..bd994013 100644 --- a/Makefile +++ b/Makefile @@ -48,3 +48,22 @@ localdocker: .PHONY: stream-monitor monitor: go build -ldflags="$(ldflags)" cmd/stream-monitor/stream-monitor.go + +.PHONY: release +release: + @if [[ ! "$(version)" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$$ ]]; then \ + echo "Must provide semantic version as arg to make." ; \ + echo "e.g. make release version=1.2.3-beta" ; \ + exit 1 ; \ + fi + @git diff --quiet || { echo "Git working directory is dirty."; exit 1 ; } + + git tag -a v$(version) -m "Release v$(version)" + git push origin v$(version) + + @echo -n "Release mist-api-connector? [y] " + @read ans && [ $${ans:-y} = y ] || { echo "Mapic release aborted, branch not fast-forwarded."; exit 1 ; } + + git checkout mapic-release + git merge --ff-only v$(version) + git push origin mapic-release