Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
build: improve tasks.py
Browse files Browse the repository at this point in the history
  • Loading branch information
saghul committed Jan 14, 2015
1 parent 9a2ffd4 commit 23301c1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import datetime
import re
import subprocess
import sys


cmd = 'git log $(git describe --tags --abbrev=0)..HEAD --format=" - %s" | tac'
Expand All @@ -17,23 +17,30 @@ def get_version():
@invoke.task
def changelog():
version = get_version()
changelog = subprocess.check_output(cmd, shell=True)
changelog = invoke.run(cmd, hide=True).stdout
print changelog_template % (version, changelog)

@invoke.task
def release():
version = get_version()

changelog = subprocess.check_output(cmd, shell=True)
r = invoke.run('git diff-files --quiet', hide=True, warn=True)
if r.failed:
print 'The repository is not clean'
sys.exit(1)

changelog = invoke.run(cmd, hide=True).stdout
with open('ChangeLog', 'r+') as f:
content = f.read()
f.seek(0)
f.write(changelog_template % (version, changelog))
f.write(content)

invoke.run('git commit -a -m "core: updated changelog"')

dt = datetime.datetime.utcnow().replace(microsecond=0)
tag = tag_template % (dt, version, changelog)
invoke.run("git tag -a pyuv-{0} -m \"{1}\"".format(version, tag))
invoke.run('git tag -a pyuv-{0} -m "{1}"'.format(version, tag))

@invoke.task
def push():
Expand Down

0 comments on commit 23301c1

Please sign in to comment.