From a8053afa93fa7fc792ac5518555304df26e60fc5 Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Fri, 20 Dec 2019 14:59:38 -0500 Subject: [PATCH 1/4] Update ReadMe.md; Add gitPushTags.groovy; Update setup.py; --- README.md | 6 +----- README.rst | 20 -------------------- setup.py | 4 ++-- vars/gitPushTags.groovy | 18 ++++++++++++++++++ 4 files changed, 21 insertions(+), 27 deletions(-) delete mode 100644 README.rst create mode 100644 vars/gitPushTags.groovy diff --git a/README.md b/README.md index 6c38549..719c2a4 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ The exit code of auto-semver determines the output. |0|Successfully ran auto-semver| |1|No merge found| |2|Not a main branch| -|3|No git flow branch name found| +|3|No version branch name found| |128|Unknown error occured| #### Flags @@ -129,10 +129,6 @@ The `semver_get_version` command returns the version number if the `semver` comm Replaces `/` with `.` in branch names. For example, `feature/test` becomes `feature.test` -### Commitless Versioning - -Because auto-semver keeps track of the version by looking at the latest git tag, instead of commiting versioned values to the repository, files can be updated upon release. - ### Jenkins Shared Library This repository is also home to a Jenkins shared library to assit in running auto-semver. diff --git a/README.rst b/README.rst deleted file mode 100644 index a717634..0000000 --- a/README.rst +++ /dev/null @@ -1,20 +0,0 @@ -Semantic Versioning -=================== - -Usage -===== - -FULL\_PATH\_TO\_LOCAL\_REPO gives container access to repo to be versioned -========================================================================== - -FULL\_PATH\_TO\_SSH\_FOLDER gives container access to ssh keys to be able to push repo -====================================================================================== - -docker build -t semver . docker run -v -FULL\_PATH\_TO\_LOCAL\_REPO:/application\_repo -v -FULL\_PATH\_TO\_SSH\_FOLDER:/root/.ssh semver - -after this finishes must go to FULL\_PATH\_TO\_LOCAL\_REPO and push yourself -============================================================================ - -git push origin develop git push origin --tags diff --git a/setup.py b/setup.py index 9c9f5cb..51be44a 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file -with open(path.join(here, 'README.rst'), encoding='utf-8') as f: +with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() def read(*parts): @@ -46,7 +46,7 @@ setup( long_description=long_description, # The project's main homepage. - url='https://git-codecommit.us-east-1.amazonaws.com/v1/repos/auto-semver', + url='https://github.com/RightBrain-Networks/auto-semver', # Author details author='RightBrain Networks', diff --git a/vars/gitPushTags.groovy b/vars/gitPushTags.groovy new file mode 100644 index 0000000..ab4c8ed --- /dev/null +++ b/vars/gitPushTags.groovy @@ -0,0 +1,18 @@ +#!/usr/bin/env groovy + +/** + * Pushes tags to a repo + * + * @param creds The Jenkins Git credentials to use. + */ + +def call(creds) { + + withCredentials([usernamePassword(credentialsId: creds, usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD')]) { + def gitOrigin = sh(script: "git remote", returnStdout: true).trim() + // Need to remove the protocol to add in user name and host + def gitHost = sh(script: "git remote get-url ${gitOrigin}", returnStdout: true).trim().replaceFirst('https://','') + // Push tags to branch + sh("git push https://${env.GIT_USERNAME}:${env.GIT_PASSWORD}@${gitHost} --tags") + } +} From 63e8c3a34827c32fbcc48493588efa58046577ab Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Fri, 20 Dec 2019 15:12:39 -0500 Subject: [PATCH 2/4] Avoid double `get_version` --- vars/runAutoSemver.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vars/runAutoSemver.groovy b/vars/runAutoSemver.groovy index 45618ab..43d364f 100644 --- a/vars/runAutoSemver.groovy +++ b/vars/runAutoSemver.groovy @@ -38,7 +38,7 @@ def call(dockerImage = "rightbrainnetworks/auto-semver:latest") { env.SEMVER_NEW_VERSION = sh(script: "grep -Po '${regex}' .bumpversion.cfg", returnStdout: true).trim() env.SEMVER_RESOLVED_VERSION = getVersion('-d') - env.VERSION = getVersion('-d') + env.VERSION = env.SEMVER_RESOLVED_VERSION } } \ No newline at end of file From bd7af42d586f071dcae50ab3c36829b491c088fa Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Fri, 20 Dec 2019 15:15:14 -0500 Subject: [PATCH 3/4] Add README.md to package --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..945f506 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +global-include README.md \ No newline at end of file From 152278ae8634fd17e4a5eac32f7c74147c72ee05 Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Fri, 20 Dec 2019 15:17:15 -0500 Subject: [PATCH 4/4] DOCUMENTATION: Remove *must* match --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 719c2a4..5d891b7 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ tag_name = v{new_version} message = Bump version: {current_version} -> {new_version} ``` -The `current_version` exists to tell bumpversion what the current version is. To have auto-semver manage this value, set it to `0.0.0` This must match what is in the VERSION file (example shown below). The `commit` and `tag` options determine whether to create a new Git commit and a new Git tag, respectively. The `tag_name` represents what the name of the Git tag will be, and by default is set to `{new_version}`, which will be substitued with the new version during runtime. This can be changed as desired - for example, `v{new_version}` could resolve to `v1.15.5`. The `message` option is what the message used if there is a git commit. +The `current_version` exists to tell bumpversion what the current version is. To have auto-semver manage this value, set it to `0.0.0`. The `commit` and `tag` options determine whether to create a new Git commit and a new Git tag, respectively. The `tag_name` represents what the name of the Git tag will be, and by default is set to `{new_version}`, which will be substitued with the new version during runtime. This can be changed as desired - for example, `v{new_version}` could resolve to `v1.15.5`. The `message` option is what the message used if there is a git commit. ### File updates