From 67f23640a8b32bbdead25e1c05a506f82764806b Mon Sep 17 00:00:00 2001 From: Sergey Klyuykov Date: Thu, 4 Apr 2019 14:10:45 +1000 Subject: [PATCH] Add autorelease script --- .gitlab-ci.yml | 17 +++++++++++++++++ autorelease.sh | 11 +++++++++++ 2 files changed, 28 insertions(+) create mode 100755 autorelease.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b36c151a..527caaeb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -125,6 +125,23 @@ pages: - developer when: always +release: + stage: release + image: onegreyonewhite/tox:tox + only: + refs: + - master + variables: + - $GIT_ACCESS_USER + - $GIT_ACCESS_PASSWORD + before_script: + - url_host=`echo "${CI_REPOSITORY_URL}" | sed -e "s/https:\/\/gitlab-ci-token:.*@//g"` + - git config --global user.name "${GITLAB_USER_NAME}" + - git config --global user.email "${GITLAB_USER_EMAIL}" + - git remote set-url origin "https://${GIT_ACCESS_USER}:${GIT_ACCESS_PASSWORD}@${url_host}" + script: + - bash autorelease.sh + release_pypi: stage: release image: onegreyonewhite/tox:centos6 diff --git a/autorelease.sh b/autorelease.sh new file mode 100755 index 00000000..6a993c17 --- /dev/null +++ b/autorelease.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +CURRENT_VERSION=$(cat polemarch/__init__.py | grep __version__ | cut -d "=" -f2 | grep -oE "[0-9\.](\.dev[0-9]{1,2}){0,1}"| tr -d '\n') +TAG=$(git tag -l $CURRENT_VERSION) + +if [ -z "${TAG}" ]; then + echo "Creating new tag ${CURRENT_VERSION}."; +# git tag $CURRENT_VERSION > /dev/null 2>&1; +# git push origin $CURRENT_VERSION > /dev/null 2>&1; +else + echo "Current release ${CURRENT_VERSION} already exists. Update version to release." +fi