Skip to content

Commit

Permalink
fix release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
1138-4EB committed Sep 29, 2019
1 parent 16ab081 commit 55e0fc6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ matrix:
if: tag IS present
script:
- git fetch --unshallow --tags
- python tools/new_release.py 'check'
- python tools/new_release.py --check
deploy:
provider: pypi
distributions: sdist
Expand All @@ -84,4 +84,4 @@ matrix:
password: $PYPI_PASSWORD
on:
repo: VUnit/vunit
branch: master
all_branches: true
11 changes: 7 additions & 4 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,15 @@ which is tagged.

In order to tag a commit:

- Set a new version in ``vunit/about.py``.
- Add a corresponding release note in ``docs/release_notes/X.Y.Z.rst``. The
release note files in ``docs/release_notes/`` are used to
- If required, bump version in ``vunit/about.py``.
- Add corresponding release notes in ``docs/release_notes/X.Y.Z.rst``. The
release notes files in ``docs/release_notes/`` are used to
automatically generate the :ref:`release notes <release_notes>`.
- Execute ``python tools/new_release.py``.
- Commit changes.
- Execute ``python tools/new_release.py``. To generate a release candidate, use cli arg ``--rc``.
- Push the new version/tag: ``git push vX.Y.Z``.
- Bump version in ``vunit/about.py``.
- Commit changes.

Travic CI makes a release by uploading a new package to PyPI when a tag
named ``vX.Y.Z`` is found in Git. A new release will not be made if:
Expand Down
32 changes: 15 additions & 17 deletions tools/new_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def tag_release(ver):
check_output([
'git',
'tag',
'"v' + ver + '" -a -m "Generated tag from TravisCI for release ' + ver + '"'
'v%s' % ver,
'-a',
'-m',
'release %s' % ver,
])


Expand All @@ -67,31 +70,26 @@ def check_release(ver):
% (ver, ver))
sys.exit(1)

if ver.endswith("rc0"):
print("Not releasing version %s since it ends with rc0" % ver)
sys.exit(1)

with urlopen('https://pypi.python.org/pypi/vunit_hdl/json') as fptr:
info = json.load(fptr)

if ver in info["releases"].keys():
print("Version %s has already been released" % ver)
sys.exit(1)

check_output([
'sed',
'-i',
'"s/PRE_RELEASE = True/PRE_RELEASE = False/"',
'vunit/about.py'
])

print("Releasing new version: %s" % ver)


if __name__ == "__main__":
if '--rc' not in sys.argv:
check_output([
'sed',
'-i',
's/PRE_RELEASE = True/PRE_RELEASE = False/',
'vunit/about.py'
])

VER = get_local_version()

if sys.argv[1] == 'check':
if '--check' in sys.argv:
check_release(VER)

tag_release(VER)
else:
tag_release(VER)
3 changes: 1 addition & 2 deletions vunit/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,4 @@ def version():

VERSION = (4, 1, 0)

# DO NOT TOUCH: Only set to False by PyPI deployment script
PRE_RELEASE = True
PRE_RELEASE = False

0 comments on commit 55e0fc6

Please sign in to comment.