Package: githubrelease
githubreleaseThis project aims at streamlining the distribution ofreleaseson Github.I made it because it sucks to have to download a file from a server,
only to upload it to Github from the desktop.It also sucks to download a file from github to your desktop, and then
SCP it to a server.This thing works nicely from an SSH session.--@j0057 on Wednesday, August 13, 2014examplesfrom the command-line:# create a prerelease$githubreleasereleasejcfr/sandboxcreate1.0.0--prerelease# upload assets$githubreleaseassetjcfr/sandboxupload1.0.0"dist/*"# publish the release$githubreleasereleasejcfr/sandboxpublish1.0.0# or all together: create with custom name, upload assets, and publish$githubreleasereleasejcfr/sandboxcreate2.0.0--publish--name"Awesome 2.0""dist/*"... or even from python:fromgithub_releaseimportgh_release_creategh_release_create("jcfr/sandbox ","2.0.0",publish=True,name="Awesome 2.0",asset_pattern="dist/*")That said, if you are looking for a full fledged GitHub API support for
Python, you should probably look into project likegithub3pyorPyGithubTable of Contentsgithubreleaseexamplesfeaturesinstallingconfiguringusing the clirelease commandasset commandref commandusing the moduletestingmaintainers: how to make a release ?licensefeaturescreate release, pre-release, or draft releaseupdate any release metadata including referenced commitsupport wildcard expression (or list of wildcard expressions):for upload or download of assetsfor selectively deleting assetsreport download and upload progressallow deleting individual asset from a releaseretry upload in case of server failuregracefully handle release with invalid assets (the ones withnewstate)authentication throughGITHUB_TOKENenvironment variable or~/.netrcfilepure python, only depends onrequestsandclickinstallingReleased stable version can be installed frompypiusing:pipinstallgithubreleaseBleeding edge version can be installed using:pipintallgithubrelease-fhttps://github.com/j0057/github-release/releases/tag/latestconfiguringFirst,generate a new token. It
should have at least thereposcope.Then, there are three options:Set theGITHUB_TOKENenvironment variable:exportGITHUB_TOKEN=YOUR_TOKEN
/path/to/commandPass the--github-tokenCLI argument. For example:$githubrelease--github-tokenYOUR_TOKENreleasejcfr/sandboxcreate--prerelease1.0.0Put the key in~/.netrc, which should have mode 0600 (-rw-------):machine api.github.com
login YOUR_TOKEN
password x-oauth-basic

machine uploads.github.com
login YOUR_TOKEN
password x-oauth-basicwhereYOUR_TOKENshould be replaced with the generated token.using the cliThe package installs one CLI namedgithubrelease.$githubreleaseUsage:githubrelease[OPTIONS]COMMAND[ARGS]...ACLItoeasilymanageGitHubreleases,assetsandreferences.

Options:--github-tokenTEXT[default:GITHUB_TOKENenv.variable]--progress/--no-progressDisplayprogressbar(default:yes).--helpShowthismessageandexit.

Commands:assetManagereleaseassets(upload,download,...)...refManagereferences(list,create,delete,...)...releaseManagereleases(list,create,delete,...)...

Run'githubrelease COMMAND --help'formoreinformationonacommand.For backward compatibility, it also installsgithub-releaseandgithub-assetreleasecommandThis command deals with releases. The general usage is:githubreleasereleaseusername/reponamecommand[tag][options]It understands the following commands:commandparametersdescriptionlistlist all releasesinfotagnamelist one releasecreatetagname [options]create a releaseedittagname [options]Edit a releasedeletetagnamedelete a releasepublishtagname [--prerelease]make release publicunpublishtagname [--prerelease]make release draftrelease-notestagnameuse $EDITOR to edit release notesOptional parameters:create:--nameNAME--bodyBODY--publish--prerelease--target-commitishTARGET_COMMITISH--help[ASSET_PATTERN]...edit:--tag-nameTAG_NAME--target-commitishTARGET_COMMITISH--nameNAME--bodyBODY--draft/--publish--prerelease/--release--dry-run--verbose--helpdelete:--keep-patternKEEP_PATTERN--type[all,draft,prerelease,release]--older-thanHOURS--dry-run--verbose--help[ASSET_PATTERN]...assetcommandThis command deals with release assets. The general usage is:githubreleaseassetusername/reponamecommand[tag][filename][options]It understands the following commands:commandparametersdescriptionlistlist all assetsuploadtagname filename...upload files to a releasedownloaddownload all files from all releases to current directorydownloadtagnamedownload all files from a release to current directorydownloadtagname filenamedownload file to current directorydeletetagname filename [options]delete a file from a releaseOptional parameters:delete:--keep-patternKEEP_PATTERNRemarks:When specifying filenames, shell-like wildcards are supported, but make sure to
quote using single quotes, i.e. don't let the shell expand the wildcard pattern.For thedownloadcommand, you also need to specify a tagname of'*'Examples:# upload all example-project-1.4* files in /home/me/pkg$githubreleaseassetoctocat/example-projectupload1.4'/home/me/pkg/example-project-1.4*'# download all wheels from all releases$githubreleaseassetoctocat/example-projectdownload'*''*.whl'# download all files from release 1.4$githubreleaseassetoctocat/example-projectdownload1.4# download all files from example-project$githubreleaseassetoctocat/example-projectdownloadrefcommandThis command deals with git references. The general usage is:githubreleaserefusername/reponamecommand[options]It understands the following commands:commandparametersdescriptioncreateref shacreate reference (e.g heads/foo, tags/foo)list[--tags] [--pattern PATTERN]list all referencesdeletepattern [--tags] [--keep-pattern KEEP_PATTERN]delete selected referencesusing the moduleThe python API mirrors the command-line interface. Most of the available
function names follows this pattern:gh_<COMMAND>_<COMMAND>where the first<COMMAND>is eitherrelease,assetorrefand the second one is any command respectively
documented above.The parameters accepted by each function also mirrors the command-line
interface. The usual signature is:gh_<COMMAND>_<COMMAND>(repo_name,[param,[param,]][option,[option]])For example, here is the signature forgh_release_create:defgh_release_create(repo_name,tag_name,name=None,publish=False,prerelease=False,target_commitish=None):The type of each parameters or options can usually be inferred from
its name. If not, consider looking atgithub_release.py.repo_name        -> str
tag_name         -> str
name             -> str
publish          -> bool
prerelease       -> bool
target_commitish -> strtestingThere are tests running automatically on TravisCI:coding style checksintegration testsSince the integration tests are expectingGITHUB_TOKENto be set, they willNOTbe executed when pull request from fork are submitted. Indeed, settingGITHUB_TOKENis required by the tests to reset and updategithub-release-bot/github-release-test-py2andgithub-release-bot/github-release-test-py3.To execute the integration tests locally, and make sure your awesome contribution
is working as expected, you will have to:create a test repository with at least one commit (e.gyourname/github-release-test)set environment variableINTEGRATION_TEST_REPO_NAME=yourname/github-release-testexecutepython setup.py testTo execute a specific test, the following also works:exportGITHUB_TOKEN=YOUR_TOKENexportINTEGRATION_TEST_REPO_NAME=yourname/github-release-test
$pytesttests/test_integration_release_create.py::test_create_releaseMoving forward, the plan would be to leverage tools likebetamaxallowing to intercept every request made and attempting to find a matching request
that has already been intercepted and recorded.maintainers: how to make a release ?Configure~/.pypircas describedhere.Make sure the cli and module work as expected.Choose the next release version number:release="X.Y.Z"ReviewCHANGES.md, replaceNext ReleaseintoX.Y.Z, commit and push. Consider using[ci skip]in commit message:sed-i-e"s/Next Release/${release}/"CHANGES.md
sed-i-e"s/============/=====/"CHANGES.md
gitaddCHANGES.md
gitcommit-m"CHANGES.md: Replace \"Next Release\" with \"${release}\"[ci skip]"Review commit, then push:gitpushoriginmasterTag the release. Requires a GPG key with signatures:gittag-s-m"githubrelease${release}"${release}origin/masterAnd push:gitpushorigin${release}Create the source tarball and binary wheels:rm-rfdist/
pythonsetup.pysdistbdist_wheelUpload the packages to the testing PyPI instance:twineupload--sign-rpypitestdist/*Check thePyPI testing package page.Upload the packages to the PyPI instance::twineupload--signdist/*Check thePyPI package page.Create a virtual env, and make sure the package can be installed:mkvirtualenvtest-githubrelease-install
pipinstallgithubreleaseCreate github release and upload packages:exportGITHUB_TOKEN=YOUR_TOKEN
githubreleasereleasej0057/github-releasecreate${release}--name${release}--publish./dist/*Update release notes by copying relevant content from CHANGES.mdexportEDITOR=vim
githubreleasereleasej0057/github-releaserelease-notes${release}Cleanupdeactivate
rmvirtualenvtest-githubrelease-installAnd updateCHANGES.md:sed-i'1i Next Release\n============\n'CHANGES.md
gitaddCHANGES.md
gitcommit-m"Begin${release}development* CHANGES.md: Add \"Next Release\" section[ci skip]"gitpushoriginmasterfaqWhy do I get arequests.exceptions.HTTPError: 401 Client Error: Unauthorized for url  https://api.github.com/repos/...?It probably means that the GitHub token you specified is invalid.licenseWritten by Joost Molenaar (@j0057) and Jean-Christophe Fillion-Robin (@jcfr)It is covered by the Apache License, Version 2.0:http://www.apache.org/licenses/LICENSE-2.0The license file was added at revision 0393859 on 2017-02-12, but you may
consider that the license applies to all prior revisions as well.