-
Notifications
You must be signed in to change notification settings - Fork 23
/
fabfile.py
58 lines (39 loc) · 1.5 KB
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python
from __future__ import print_function
import re
import subprocess
from fabric.api import task
@task
def release(part='patch'):
""" Automated software release workflow
* (Configurably) bumps the version number
* Tags the release
You can run it like::
$ fab release
which, by default, will create a 'patch' release (0.0.1 => 0.0.2).
You can also specify a patch level (patch, minor, major) to change to::
$ fab release:part=major
which will create a 'major' release (0.0.2 => 1.0.0).
"""
# Dry run 'bumpversion' to find out what the new version number
# would be. Useful side effect: exits if the working directory is not
# clean.
bumpver = subprocess.check_output(
['bumpversion', part, '--dry-run', '--verbose'],
stderr=subprocess.STDOUT)
m = re.search(r'New version will be \'(\d+\.\d+\.\d+)\'', bumpver.decode('utf-8'))
version = m.groups(0)[0]
# Really run bumpver to set the new release and tag
bv_args = ['bumpversion', part]
bv_args += ['--new-version', version]
subprocess.check_output(bv_args)
# @task
# def deploy(version=None):
# """Since I handle deployment in Travis CI, this should never be called"""
# if not version:
# version = subprocess.check_output(['python',
# 'setup.py', '--version']).strip()
#
# # Build the package
# subprocess.check_output(['python', 'setup.py', 'sdist', 'upload', '-r', 'pypi'])
#