now this can be a docker container and version a different repository that is on same file system

This commit is contained in:
Michael Gimbel 2017-02-23 22:11:55 +00:00
parent 867b4d7e63
commit c5a4c697f3
5 changed files with 47 additions and 5 deletions

View File

@ -8,4 +8,3 @@ message = Bump version: {current_version} -> {new_version}
[bumpversion:file:VERSION]
search = version={current_version}
replace = version={new_version}

View File

@ -17,5 +17,4 @@ RUN chown -R semver:semver /semver && chmod -R ug+x /semver/*
RUN pip install -r requirements.txt
#CMD python get_version.py
CMD tail -f get_version.py
CMD python semver.py && python get_version.py

View File

@ -1,3 +1,13 @@
Semantic Versioning
----------
2
Usage
-----
docker build -t semver .
docker run -v FULL_PATH_TO_LOCAL_REPO:/application_repo semver
# after this finishes must go to FULL_PATH_TO_LOCAL_REPO and push yourself
git push origin develop
git push origin --tags

View File

@ -3,7 +3,7 @@ from ConfigParser import ConfigParser
def get_version():
config = ConfigParser()
config.read('.bumpversion.cfg')
config.read('/application_repo/.bumpversion.cfg')
version = config.get('bumpversion', 'current_version')
return version

34
semver.py Normal file
View File

@ -0,0 +1,34 @@
import subprocess
def semver():
# setup git user
p = subprocess.Popen(['git', 'config', 'user.email',
'"versioner@semver.com"'], cwd='/application_repo')
p = subprocess.Popen(['git', 'config', 'user.name', '"Semantic Versioner"'],
cwd='/application_repo')
p.wait()
# version repo
p = subprocess.Popen(['bumpversion', 'patch'], cwd='/application_repo')
p.wait()
'''
' this will be difficult to do because we'd need to setup credentials in
' docker container for git remote repo access
'
# push versioning commit
p = subprocess.Popen(['git', 'push', 'origin', 'develop'],
cwd='/application_repo')
p.wait()
# push versioning tag
p = subprocess.Popen(['git', 'push', 'origin', '--tags'],
cwd='/application_repo')
p.wait()
'''
return None
if __name__ == '__main__':
semver()