Skip to content

Commit

Permalink
Broke out the ability to create tags from checking if tags match
Browse files Browse the repository at this point in the history
  • Loading branch information
GregHilston committed Aug 27, 2020
1 parent f6507f7 commit b42c197
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ circle-ci-validate: ## Validates the circleci config.
circle-ci-local-execute: ## Execute circleci config locally.
circleci local execute

deploy: clean-old-packages create-github-release package upload-pypi ## Deploys new version to PyPi
deploy: clean-old-packages create-github-release package upload-pypi ## Deploys new version by creating a new Github Tag, Release and uploading to PyPi
17 changes: 15 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class VerifyVersionCommand(install):
description = 'verify that the git tag matches our version'

def run(self):
self.create_matching_git_tag()
latest_git_tag = subprocess.run(['git', 'describe', '--abbrev=0', '--tags'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).stdout.decode("utf-8").rstrip('\n')

if latest_git_tag != VERSION_WITH_LEADING_V:
Expand All @@ -36,10 +35,23 @@ def run(self):
)
sys.exit(info)

def create_matching_git_tag(self):

class CreateGithubTag(Command):
"""Create a github tag"""
description = "Create a Github tag"
user_options = []

def initialize_options(self):
pass

def finalize_options(self):
pass

def run(self):
subprocess.run(["git", "tag", VERSION_WITH_LEADING_V])
subprocess.run(["git", "push", "--tags"])


class CreateGithubRelease(Command):
"""Inspired by https://www.barrykooij.com/create-github-releases-via-command-line/"""
description = "Creates a Github Release"
Expand Down Expand Up @@ -123,6 +135,7 @@ def run(self):
python_requires='>=3.7',
cmdclass={
'verify': VerifyVersionCommand,
'create_github_tag': CreateGithubTag,
'create_github_release': CreateGithubRelease,
'custom_clean': CustomClean,
}
Expand Down

0 comments on commit b42c197

Please sign in to comment.