Skip to content

Commit ec150cb

Browse files
committed
Change name to fiaas-publish, and use githubrelease library
1 parent 8326d1d commit ec150cb

File tree

4 files changed

+19
-106
lines changed

4 files changed

+19
-106
lines changed

README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ In order to use publish, you must first install it::
2828

2929
Under the covers, publish uses github-release_ and twine_ to do most of the work, and those tools require credentials for Github and PyPI to be available in environment variables::
3030

31-
export GITHUB_USER=gh-user
3231
export GITHUB_TOKEN=gh-token
3332
export TWINE_USERNAME=pypi-user
3433
export TWINE_PASSWORD=pypi-pass
@@ -47,5 +46,5 @@ Before uploading anything, publish will verify that the current checkout is suit
4746

4847
If the answer to all of these is yes, the name of the tag is used as the version to release. A changelog is generated from the git log, source tarballs and wheels are built, the release is created in Github and PyPI, and the files are uploaded.
4948

50-
.. _github-release: https://github.com/aktau/github-release
49+
.. _github-release: https://github.com/j0057/github-release
5150
.. _twine: https://github.com/pypa/twine

get_github_release.py

Lines changed: 0 additions & 75 deletions
This file was deleted.

publish.py

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,22 @@
1313
- Check if the build refers exactly to an annotated tag following the convention above
1414
- Generate a suitable changelog
1515
- Create packages for upload (wheels and tarballs)
16-
- Use https://github.com/aktau/github-release to create a Github release
16+
- Use https://github.com/j0057/github-release to create a Github release
1717
- Use the projects setup.py to create a PyPi release (using Twine for upload)
1818
"""
1919
from __future__ import unicode_literals, print_function
2020

2121
import argparse
22-
import subprocess
23-
2422
import os
2523
import re
26-
import six
24+
import subprocess
2725
import sys
2826
import tempfile
27+
28+
import six
2929
from git import Repo, BadName, GitCommandError
3030
from git.cmd import Git
31-
32-
from get_github_release import get_github_release
31+
from github_release import gh_release_create
3332

3433
# Magical, always present, empty tree reference
3534
# https://stackoverflow.com/questions/9765453/
@@ -118,7 +117,7 @@ def _shorten(self, sha):
118117
class Uploader(object):
119118
def __init__(self, options, version, changelog, artifacts):
120119
self.dry_run = options.dry_run
121-
self.repo = options.repository
120+
self.repo = "{}/{}".format(options.organization, options.repository)
122121
self.version = version
123122
self.changelog = changelog
124123
self.artifacts = artifacts
@@ -139,20 +138,10 @@ def _call(self, *args, **kwargs):
139138

140139
def github_release(self):
141140
"""Create release in github, and upload artifacts and changelog"""
142-
gh_path = get_github_release()
143-
self._call(gh_path, "release",
144-
"--repo", self.repo,
145-
"--tag", self.version,
146-
"--description", format_gh_changelog(self.changelog),
147-
msg="Failed to create release on Github")
148-
for artifact in self.artifacts:
149-
name = os.path.basename(artifact)
150-
self._call(gh_path, "upload",
151-
"--repo", self.repo,
152-
"--tag", self.version,
153-
"--name", name,
154-
"--file", artifact,
155-
msg="Failed to upload artifact {} to Github".format(name))
141+
gh_release_create(
142+
self.repo, self.version, self.artifacts,
143+
body=format_gh_changelog(self.changelog), publish=True, dry_run=self.dry_run
144+
)
156145

157146
def pypi_release(self):
158147
"""Create release in pypi.python.org, and upload artifacts and changelog"""

setup.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@
55
from setuptools import setup
66

77
GENERIC_REQ = [
8-
"six==1.11.0",
8+
"six==1.12.0",
99
'GitPython==2.1.11',
10-
"twine==1.12.1"
10+
"twine==1.12.1",
11+
"githubrelease==1.5.8",
1112
]
1213

1314
CODE_QUALITY_REQ = [
1415
'prospector',
1516
]
1617

1718
TESTS_REQ = [
18-
'tox==3.4.0',
19+
'tox==3.6.1',
1920
'mock==2.0.0',
20-
'pytest==3.8.2',
21+
'pytest==4.0.2',
2122
'pytest-cov==2.6.0',
2223
'pytest-html==1.19.0',
23-
'pytest-sugar==0.9.1',
24+
'pytest-sugar==0.9.2',
2425
]
2526

2627

@@ -46,7 +47,7 @@ def _read(filename):
4647

4748
def main():
4849
setup(
49-
name="publish",
50+
name="fiaas-publish",
5051
author="FiaaS developers",
5152
author_email="fiaas@googlegroups.com",
5253
use_scm_version=True,
@@ -89,8 +90,7 @@ def main():
8990
# Entrypoints
9091
entry_points={
9192
"console_scripts": [
92-
"publish=publish:main",
93-
"get_github_release=get_github_release:main"
93+
"publish=publish:main"
9494
]
9595
}
9696

0 commit comments

Comments
 (0)