sbt / sbt-dynver

An sbt plugin to dynamically set your version from git

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Avoid double publishing on commit + tag push

dwijnand opened this issue · comments

A long-standing issue with sbt-dynver and publishing on Travis CI is that when you create a commit (e.g. bump the version number in the README) and a tag, and push both, then Travis CI will kick-off two builds and one will fail (race condition to Bintray, for example).

Found this code to avoid it:

	if [ -z "$TRAVIS_TAG" ]; then
		TRAVIS_TAG=$( git -C "$TRAVIS_BUILD_DIR" tag --points-at )
		if [ -n "$TRAVIS_TAG" ]; then
			echo "Found future tag \"${TRAVIS_TAG}\", skipping."
			exit 0
		fi
	fi