From 69237450ac1db69c51971630d3ba2290b36ce9d1 Mon Sep 17 00:00:00 2001 From: Rodrigo Araya Date: Wed, 20 Mar 2019 14:51:30 -0700 Subject: [PATCH] add release script (#15) --- .circleci/config.yml | 1 + .circleci/release_check.sh | 27 ++++++++++++++++++++++++ release.sh | 43 ++++++++++++++++++++++++++++++++++++++ setup.py | 9 +++++--- 4 files changed, 77 insertions(+), 3 deletions(-) create mode 100755 .circleci/release_check.sh create mode 100755 release.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 839d977bfaee4..2a75bcda34b64 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -43,6 +43,7 @@ jobs: <<: *defaults steps: - checkout + - run: ./.circleci/release_check.sh - run: pip install --user twine - run: python setup.py sdist - run: python -m twine upload --verbose dist/* diff --git a/.circleci/release_check.sh b/.circleci/release_check.sh new file mode 100755 index 0000000000000..b4e257e900fb3 --- /dev/null +++ b/.circleci/release_check.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e -x -u + +expected_version=$CIRCLE_TAG +current_version=$(python ./setup.py --version) +echo "current_version is ${current_version}" +echo "expected_version is ${expected_version}" + +if [[ "${current_version}" != "${expected_version}" ]]; then + echo "Packaging code ${current_version} does not equal to tagged version, ${expected_version}" + exit 1 +else + exit 0 +fi diff --git a/release.sh b/release.sh new file mode 100755 index 0000000000000..6fb1f8968c12b --- /dev/null +++ b/release.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e -x + +# Usage: $ ./prepare_for_release.py +# type - [major | minor | patch]. Default is patch. + +branch=$(git rev-parse --abbrev-ref HEAD) +if [[ "${branch}" != "master" ]]; then + echo "You may only tag a commit on the 'master' branch" + exit 1; +fi + +type=${1} +if [ -z "${type}" ] +then + echo "defaulting to 'patch'" + type="patch" +else + echo "update type is: ${type}" +fi + +version=$(python ./setup.py --version) +echo "Upgrading version from the current version of ${version}" + + +# The {new_version} is not a bash variable - it's a bumpversion notation for the new version. +# Please see bumpversion --help for more information. +bumpversion --current-version ${version} --commit --tag --tag-name {new_version} ${type} ./setup.py +git push --tags origin master +echo "Done pushing to master" diff --git a/setup.py b/setup.py index 0790ca426ef6d..ed2786138b596 100644 --- a/setup.py +++ b/setup.py @@ -15,9 +15,12 @@ with open("README.md", "r") as f: long_description = f.read() +NAME = "marquez-airflow" +VERSION = "0.0.2" + setuptools.setup( - name="marquez-airflow", - version="0.0.2", + name=NAME, + version=VERSION, author="Marquez Team", author_email="", description="Marquez integration with Airflow", @@ -26,6 +29,6 @@ url="https://github.com/MarquezProject/marquez-airflow", packages=setuptools.find_packages(), install_requires=[ - "marquez-python==0.1.7", + "marquez-python==0.1.11", ], )