Skip to content

Commit

Permalink
add release script (apache#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
roaraya8 authored Mar 20, 2019
1 parent 24ec1fb commit 6923745
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 3 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
Expand Down
27 changes: 27 additions & 0 deletions .circleci/release_check.sh
Original file line number Diff line number Diff line change
@@ -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
43 changes: 43 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -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>
# 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"
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
],
)

0 comments on commit 6923745

Please sign in to comment.