-
Notifications
You must be signed in to change notification settings - Fork 5
/
release.py
35 lines (26 loc) · 954 Bytes
/
release.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
# Quick and dirty script to make releases. Generally modeled on
# zest.release, but far less ambitious.
import datetime
import os
with open('CHANGES.rst') as f:
changes = f.read()
before, after = changes.split('(unreleased)')
before, version = before.rsplit('\n', 1)
version = version.strip()
M, m, p = map(int, version.split('.'))
changes = before + ("""
%d.%d.%d (unreleased)
=====================
Nothing changed yet
%s (%s)""" % (M, m, p+1, version, datetime.date.today().isoformat())
) + after
with open('release.cfg', 'w') as f:
f.write("[buildout]\nrelease = %s\n" % version)
with open('client/version.js', 'w') as f:
f.write("export default %r;\n" % version)
with open('CHANGES.rst', 'w') as f:
f.write(changes)
if not os.system("git commit -am 'Releasing %s'" % version):
if not os.system("git tag '%s'" % version):
if not os.system("git push"):
os.system("git push --tags")