diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 25013f2..6153423 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,28 +1,18 @@ [bumpversion] -current_version = 1.4.11 commit = False tag = False tag_name = {new_version} tag_message = Bump version to {new_version} message = Bump version to {new_version} parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\.(?P[a-z]+)(?P\d+))? -serialize = - {major}.{minor}.{patch}.{release}{dev} +serialize = {major}.{minor}.{patch} -[bumpversion:part:release] -optional_value = prod -values = - dev - prod - -[bumpversion:part:dev] - [bumpversion:file:setup.py] -search = version='{current_version}' +search = version='0.0.0' replace = version='{new_version}' [bumpversion:file:aodntools/__init__.py] -search = __version__ = '{current_version}' +search = __version__ = '0.0.0' replace = __version__ = '{new_version}' diff --git a/Jenkinsfile b/Jenkinsfile index 55aa164..f414731 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,17 +18,11 @@ pipeline { sh 'git clean -xffd' } } - stage('set_version') { - when { not { branch "master" } } - steps { - sh './bumpversion.sh build' - } - } stage('release') { when { branch 'master' } steps { withCredentials([usernamePassword(credentialsId: env.GIT_CREDENTIALS_ID, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) { - sh './bumpversion.sh release' + sh './bumpversion.sh' } } } diff --git a/aodntools/__init__.py b/aodntools/__init__.py index a314565..c57bfd5 100644 --- a/aodntools/__init__.py +++ b/aodntools/__init__.py @@ -1 +1 @@ -__version__ = '1.4.11' +__version__ = '0.0.0' diff --git a/bumpversion.sh b/bumpversion.sh index 6c3655c..4559475 100755 --- a/bumpversion.sh +++ b/bumpversion.sh @@ -2,29 +2,11 @@ set -euxo pipefail -RELEASE_BRANCH=master - -bumpversion_build() { - bump2version patch -} - -bumpversion_release() { - git fetch --prune origin "+refs/tags/*:refs/tags/*" - bump2version patch - VERSION=$(bump2version --list --tag --commit --allow-dirty release | grep -oP '^new_version=\K.*$') - git push --atomic origin HEAD:$RELEASE_BRANCH tag $VERSION -} - main() { - local mode=$1; shift - - if [ "x${mode}" == "xbuild" ] - then - bumpversion_build - elif [ "x${mode}" == "xrelease" ] - then - bumpversion_release - fi + git fetch --prune origin "+refs/tags/*:refs/tags/*" + OLD_VERSION=$(git tag -l '*.*.*' --sort=-version:refname | head -n 1) + NEW_VERSION=$(bump2version --current-version $OLD_VERSION --list --tag --commit --allow-dirty patch | grep -oP '^new_version=\K.*$') + git push origin tag $NEW_VERSION exit 0 } diff --git a/setup.py b/setup.py index c4da261..be44198 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ setup( name=PACKAGE_NAME, - version='1.4.11', + version='0.0.0', packages=find_packages(exclude=PACKAGE_EXCLUDES), package_data=PACKAGE_DATA, url='https://github.com/aodn',