Skip to content

Commit

Permalink
chore: release automation (#320)
Browse files Browse the repository at this point in the history
Add semantic-release to this repo. Pre release versions should be installed
using pip's native support for installing from a branch, e.g.
pip install git+https://github.com/Paperspace/gradient-cli.git@chore-release-automation
  • Loading branch information
bbatha committed Sep 17, 2020
1 parent f0017b6 commit 8f9c761
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 11 deletions.
39 changes: 36 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
version: 2.1

orbs:
release-tools: paperspace/release-tools@0.1.0

workflows:
build_and_deploy:
master:
jobs:
- test:
filters:
branches:
only: master
tags:
only: /.*/
- deploy:
- release-tools/release:
name: create release
context: semantic-release
workspace: .
requires:
- test
filters:
branches:
only: master

pr:
jobs:
- test:
filters:
branches:
ignore: master

release:
jobs:
- deploy:
filters:
tags:
only: /.*/
branches:
ignore: /.*/

executors:
python-tox:
docker:
Expand All @@ -29,12 +53,21 @@ jobs:
- run:
name: Run tests
command: make run-tests
- persist_to_workspace:
root: .
paths:
- "."

deploy:
docker:
- image: circleci/python:3.6
steps:
- checkout
- run:
name: Make version.py
command: |
echo "Publishing version $CIRCLE_TAG"
echo "version = \"${CIRCLE_TAG}\"" > gradient/version.py
- run:
name: import GPG key
command: |
Expand All @@ -45,7 +78,7 @@ jobs:
command: |
make pip-install-dev
- run:
name: verify git tag vs. version
name: verify version is valid
command: |
python setup.py verify
- run:
Expand Down
2 changes: 1 addition & 1 deletion gradient/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "0.9.1a5"
version = "0.0.0"
9 changes: 2 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,8 @@ class VerifyVersionCommand(install):
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)
if '0.0.0' == version:
sys.exit("Version unspecified")


setup(
Expand Down

0 comments on commit 8f9c761

Please sign in to comment.