From e1f567829f3a28acc24998ada94113208fab0077 Mon Sep 17 00:00:00 2001 From: Andrew Widdersheim Date: Fri, 3 Aug 2018 15:29:10 -0400 Subject: [PATCH] Fix deploy --- .circleci/config.yml | 2 +- release.py | 44 ++++++++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3f74a38..ea563b6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -142,6 +142,6 @@ workflows: - build filters: branches: - only: master + ignore: /.*/ tags: only: /^v.*/ diff --git a/release.py b/release.py index ef2e802..ed85b4f 100644 --- a/release.py +++ b/release.py @@ -15,25 +15,29 @@ def run_command(command): ).strip().decode('utf-8') -github = Github(os.environ['GITHUB_TOKEN']) - -repo = github.get_user().get_repo( - run_command('python setup.py --name'), -) - -tag = 'v{}'.format(run_command('python setup.py --version')) - -release = repo.create_git_release( - tag=tag, - name=tag, - message=run_command( - 'git show --no-patch --pretty=format:"%s%n%b" {}'.format( - os.environ['CIRCLE_SHA1'], +def main() + github = Github(os.environ['GITHUB_TOKEN']) + + repo = github.get_user().get_repo( + run_command('python setup.py --name'), + ) + + tag = 'v{}'.format(run_command('python setup.py --version')) + + release = repo.create_git_release( + tag=tag, + name=tag, + message=run_command( + 'git show --no-patch --pretty=format:"%s%n%b" {}'.format( + os.environ['CIRCLE_SHA1'], + ), ), - ), - prerelease=os.environ.get('CIRCLE_TAG') is None, - target_commitish=os.environ.get('CIRCLE_TAG', os.environ['CIRCLE_SHA1']) -) + target_commitish=os.environ['CIRCLE_SHA1'], + ) + + for item in glob.glob(sys.argv[1]): + release.upload_asset(item) -for item in glob.glob(sys.argv[1]): - release.upload_asset(item) +if __name__ == '__main__': + if os.environ.get('CIRCLE_TAG'): + main()