From 2a134a490b64476fc00129bd396c3d92e2ebed7f Mon Sep 17 00:00:00 2001 From: Luca Ongaro Date: Wed, 21 Sep 2016 13:29:41 +0200 Subject: [PATCH] some checks in `make release` --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 66be757..2e6816a 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,13 @@ VERSION = $(shell crystal eval 'require "yaml"; s = YAML.parse(File.read("./shard.yml")); puts s["version"]') +CONST_VERSION = $(shell crystal eval 'require "./src/immutable/version"; puts Immutable::VERSION') +GIT_STATUS = $(shell git status -s) docsite: crystal docs && git checkout gh-pages && mkdir -p api && cp -r doc/. api && git add api && git commit -m "generate docs" && git push && git checkout master release: + @test "$(VERSION)" == "$(CONST_VERSION)" || { echo "Error: version in shards.yml does not match version in code"; exit 1; } + @test "$(GIT_STATUS)" == "" || { echo "Error: uncommitted changes"; exit 1; } git fetch && git tag v$(VERSION) origin/master && git push origin v$(VERSION) open https://github.com/lucaong/immutable/releases/new?tag=v$(VERSION)