Skip to content

Instantly share code, notes, and snippets.

@loa
Created February 26, 2015 15:08
Show Gist options
  • Save loa/c2fe15baaed7f4ddccf6 to your computer and use it in GitHub Desktop.
Save loa/c2fe15baaed7f4ddccf6 to your computer and use it in GitHub Desktop.
Python verify Git Head is not tagged release
#!/usr/bin/env python
import sys
import re
import subprocess
# Make sure HEAD is not a release
gitdescribe = subprocess.check_output('git describe', shell=True)
release_pattern = re.compile(r"^(v|)\d+\.\d+\.\d+$")
if release_pattern.match(gitdescribe):
sys.stderr.write("ERROR: HEAD is a release, will not release\n")
sys.exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment