Skip to content

Commit fa7c1fe

Browse files
updating release process
1 parent 4495d0d commit fa7c1fe

File tree

2 files changed

+45
-21
lines changed

2 files changed

+45
-21
lines changed

RELEASE.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
* Update version constants (find them by running `git grep [VERSION_NUMBER]`)
44
* Create changelog entry (edit CHANGELOG.md with a one-liner for each closed issue going in the release)
55
* Commit and push changes to master with the message: "Version Bump to v[VERSION_NUMBER]"
6-
* Push tag and PyPi `fab release:[VERSION_NUMBER]`. Before you do this, make sure you have the organization repository set up as upstream remote & fabric installed (`pip install fabric`), also make sure that you have pip set up with your PyPi user credentials. The easiest way to do that is to create a file at `~/.pypirc` with the following contents:
6+
* Make sure your `upstream` repo is set
7+
```
8+
git remote -v
9+
upstream [email protected]:softlayer/softlayer-python.git (fetch)
10+
upstream [email protected]:softlayer/softlayer-python.git (push)
11+
```
12+
* Push tag and PyPi `python fabfile.py 5.7.2`. Before you do this, make sure you have the organization repository set up as upstream remote, also make sure that you have pip set up with your PyPi user credentials. The easiest way to do that is to create a file at `~/.pypirc` with the following contents:
713

814
```
915
[server-login]

fabfile.py

+38-20
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,67 @@
1+
import click
12
import os.path
23
import shutil
3-
4-
from fabric.api import local, lcd, puts, abort
5-
4+
import subprocess
5+
import sys
6+
from pprint import pprint as pp
67

78
def make_html():
8-
"Build HTML docs"
9-
with lcd('docs'):
10-
local('make html')
11-
9+
"""Build HTML docs"""
10+
click.secho("Building HTML")
11+
subprocess.run('make html', cwd='docs', shell=True)
1212

1313
def upload():
14-
"Upload distribution to PyPi"
15-
local('python setup.py sdist bdist_wheel')
16-
local('twine upload dist/*')
14+
"""Upload distribution to PyPi"""
15+
cmd_setup = 'python setup.py sdist bdist_wheel'
16+
click.secho("\tRunning %s" % cmd_setup, fg='yellow')
17+
subprocess.run(cmd_setup, shell=True)
18+
cmd_twine = 'twine upload dist/*'
19+
click.secho("\tRunning %s" % cmd_twine, fg='yellow')
20+
subprocess.run(cmd_twine, shell=True)
1721

1822

1923
def clean():
20-
puts("* Cleaning Repo")
24+
click.secho("* Cleaning Repo")
2125
directories = ['.tox', 'SoftLayer.egg-info', 'build', 'dist']
2226
for directory in directories:
2327
if os.path.exists(directory) and os.path.isdir(directory):
2428
shutil.rmtree(directory)
2529

2630

27-
def release(version, force=False):
31+
@click.command()
32+
@click.argument('version')
33+
@click.option('--force', default=False, is_flag=True, help="Force upload")
34+
def release(version, force):
2835
"""Perform a release. Example:
2936
30-
$ fab release:3.0.0
37+
$ python fabfile.py 1.2.3
3138
3239
"""
3340
if version.startswith("v"):
34-
abort("Version should not start with 'v'")
41+
exit("Version should not start with 'v'")
3542
version_str = "v%s" % version
3643

3744
clean()
3845

39-
local("pip install wheel")
46+
subprocess.run("pip install wheel", shell=True)
4047

41-
puts(" * Uploading to PyPI")
48+
print(" * Uploading to PyPI")
4249
upload()
50+
make_html()
4351

44-
puts(" * Tagging Version %s" % version_str)
4552
force_option = 'f' if force else ''
46-
local("git tag -%sam \"%s\" %s" % (force_option, version_str, version_str))
53+
cmd_tag = "git tag -%sam \"%s\" %s" % (force_option, version_str, version_str)
54+
55+
click.secho(" * Tagging Version %s" % version_str)
56+
click.secho("\tRunning %s" % cmd_tag, fg='yellow')
57+
subprocess.run(cmd_tag, shell=True)
58+
59+
60+
cmd_push = "git push upstream %s" % version_str
61+
click.secho(" * Pushing Tag to upstream")
62+
click.secho("\tRunning %s" % cmd_push, fg='yellow')
63+
subprocess.run(cmd_push, shell=True)
64+
4765

48-
puts(" * Pushing Tag to upstream")
49-
local("git push upstream %s" % version_str)
66+
if __name__ == '__main__':
67+
release()

0 commit comments

Comments
 (0)