mirror of
https://github.com/saymrwulf/cryptography.git
synced 2026-05-14 20:37:55 +00:00
Replace release automation with click (#3557)
* Replace release automation with click * Fix * fix
This commit is contained in:
parent
a4668c6593
commit
c7dd9de42f
3 changed files with 24 additions and 13 deletions
|
|
@ -1,6 +1,6 @@
|
|||
click
|
||||
clint
|
||||
coverage
|
||||
invoke
|
||||
requests
|
||||
tox >= 2.4.1
|
||||
twine
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ The commit that merged the version number bump is now the official release
|
|||
commit for this release. You will need to have ``gpg`` installed and a ``gpg``
|
||||
key in order to do a release. Once this has happened:
|
||||
|
||||
* Run ``invoke release {version}``.
|
||||
* Run ``python release.py {version}``.
|
||||
|
||||
The release should now be available on PyPI and a tag should be available in
|
||||
the repository.
|
||||
|
|
|
|||
|
|
@ -7,11 +7,12 @@ from __future__ import absolute_import, division, print_function
|
|||
import getpass
|
||||
import io
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
from clint.textui.progress import Bar as ProgressBar
|
||||
import click
|
||||
|
||||
import invoke
|
||||
from clint.textui.progress import Bar as ProgressBar
|
||||
|
||||
import requests
|
||||
|
||||
|
|
@ -19,6 +20,11 @@ import requests
|
|||
JENKINS_URL = "https://jenkins.cryptography.io/job/cryptography-wheel-builder"
|
||||
|
||||
|
||||
def run(*args, **kwargs):
|
||||
kwargs.setdefault("stderr", subprocess.STDOUT)
|
||||
subprocess.check_output(list(args), **kwargs)
|
||||
|
||||
|
||||
def wait_for_build_completed(session):
|
||||
# Wait 20 seconds before actually checking if the build is complete, to
|
||||
# ensure that it had time to really start.
|
||||
|
|
@ -95,20 +101,21 @@ def download_artifacts(session):
|
|||
return paths
|
||||
|
||||
|
||||
@invoke.task
|
||||
@click.command()
|
||||
@click.argument("version")
|
||||
def release(version):
|
||||
"""
|
||||
``version`` should be a string like '0.4' or '1.0'.
|
||||
"""
|
||||
invoke.run("git tag -s {0} -m '{0} release'".format(version))
|
||||
invoke.run("git push --tags")
|
||||
run("git", "tag", "-s", version, "-m", "{0} release".format(version))
|
||||
run("git", "push", "--tags")
|
||||
|
||||
invoke.run("python setup.py sdist")
|
||||
invoke.run("cd vectors/ && python setup.py sdist bdist_wheel")
|
||||
run("python", "setup.py", "sdist")
|
||||
run("python", "setup.py", "sdist", "bdist_wheel", cwd="vectors/")
|
||||
|
||||
invoke.run(
|
||||
"twine upload -s dist/cryptography-{0}* "
|
||||
"vectors/dist/cryptography_vectors-{0}*".format(version)
|
||||
run(
|
||||
"twine", "upload", "-s", "dist/cryptography-{0}*".format(version),
|
||||
"vectors/dist/cryptography_vectors-{0}*".format(version), shell=True
|
||||
)
|
||||
|
||||
session = requests.Session()
|
||||
|
|
@ -135,4 +142,8 @@ def release(version):
|
|||
response.raise_for_status()
|
||||
wait_for_build_completed(session)
|
||||
paths = download_artifacts(session)
|
||||
invoke.run("twine upload {0}".format(" ".join(paths)))
|
||||
run("twine", "upload", " ".join(paths))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
release()
|
||||
Loading…
Reference in a new issue