diff --git a/Makefile b/Makefile index 61e980d..997f47e 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,10 @@ testpypi: clean sdist bdist_wheel pypi: clean sdist bdist_wheel twine upload dist/* +.PHONY: on_master +on_master: + ./on_master.sh + .PHONY: tag -tag: +tag: on_master git tag -a $$(python -c 'from flake8_aaa.__about__ import __version__; print("v{}".format(__version__))') diff --git a/on_master.sh b/on_master.sh new file mode 100755 index 0000000..855374c --- /dev/null +++ b/on_master.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -eo pipefail + +git fetch origin -v + +branch_info=$(git status --short -b | head -1) + +if [[ $branch_info != '## master...origin/master' ]]; then + echo "Not on master or master not up to date with origin, branch = $branch_info" + exit 1 +fi