Skip to content

Commit

Permalink
Merge pull request #7 from hotzenklotz/auto-release
Browse files Browse the repository at this point in the history
Automated Releases
  • Loading branch information
hotzenklotz authored Oct 26, 2018
2 parents 867fc0e + 6d3a1d7 commit 381d55f
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 7 deletions.
48 changes: 48 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,51 @@ jobs:
- store_artifacts:
path: test-reports

deploy:
docker:
- image: circleci/python:3.7.0
steps:
- checkout
- run:
name: Install Python Dependencies
command: |
sudo pip install pipenv
pipenv install --three
- run:
name: verify git tag vs. version
command: |
pipenv run python setup.py verify
- run:
name: init .pypirc
command: |
echo -e "[pypi]" >> ~/.pypirc
echo -e "username = therold" >> ~/.pypirc
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
- run:
name: create packages
command: |
pipenv run python setup.py sdist
pipenv run python setup.py bdist_wheel
- run:
name: upload to pypi
command: |
pipenv run twine upload dist/*
workflows:
version: 2
build_and_deploy:
jobs:
- build:
filters:
tags:
only: /.*/
- deploy:
requires:
- build
filters:
tags:
only: /[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/

1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ name = "pypi"

[packages]
pytest = "==3.8.1"
twine = "*"

[dev-packages]

Expand Down
114 changes: 110 additions & 4 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 30 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
from setuptools import setup
from setuptools.command.test import test as TestCommand
from setuptools.command.install import install
import sys
import os

import pybeerxml

# circleci.py version
VERSION = "1.0.3"

def readme():
"""print long description"""
with open('README.md') as f:
return f.read()


class VerifyVersionCommand(install):
"""Custom command to verify that the git tag matches our version"""
description = 'verify that the git tag matches our version'

def run(self):
tag = os.getenv('CIRCLE_TAG')

if tag != VERSION:
info = "Git tag: {0} does not match the version of this app: {1}".format(
tag, VERSION
)
sys.exit(info)

class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
Expand All @@ -18,14 +42,17 @@ def run_tests(self):
setup(
name = 'pybeerxml',
packages = ['pybeerxml'],
version = '1.0.2',
version = VERSION,
description = 'A BeerXML Parser',
author = 'Tom Herold',
author_email = '[email protected]',
url = 'https://github.com/hotzenklotz/pybeerxml',
download_url = 'https://github.com/hotzenklotz/pybeerxml/tarball/1.0.2',
download_url = 'https://github.com/hotzenklotz/pybeerxml/tarball/{}'.format(VERSION),
tests_require=['pytest'],
cmdclass={'test': PyTest},
cmdclass={
'test': PyTest,
'verify': VerifyVersionCommand
},
platforms='any',
keywords = ['beerxml', 'beer', 'xml', 'brewing'],
classifiers = [],
Expand Down

0 comments on commit 381d55f

Please sign in to comment.