GitHub Release Activity (rever.activities.ghrelease)

Activity for performing a GitHub release.

class rever.activities.ghrelease.GHRelease

Performs a github release.

The behaviour of this activity may be adjusted through the following environment variables:

$GHRELEASE_NAME

str, Name of the release. This is evaluated with the version. Default is $VERSION

$GHRELEASE_NOTES

str or None, Release notes to send to the release page. If None (the default), this is read from $CHANGELOG_LATEST, if present, or failing that $REVER_DIR/LATEST. If neither file exists, an empty string is passes in.

$GHRELEASE_PREPEND

str, string to prepend to the release notes, defaults to ‘’

$GHRELEASE_APPEND

str, string to append to the release notes, defaults to ‘’

$GHRELEASE_ASSETS

iterable of str or functions, Extra assests to upload to the GitHub release. This is ususally a tarball of the source code or a binary package. If the asset is a string, it is interpreted as a filename (and evalauated in the current environment). If the asset is a function, the function is called with no arguments and should return either a string filename or a list of string filenames. The asset functions will usually generate or acquire the asset. By default, this a tarball of the release tag will be uploaded.

$GHRELEASE_TARGET

str or None, the git branch/commit to target for the release. If this value is None, it will use the default branch name, as specified on the GitHub repo.

Other environment variables that affect the behavior are:

$GITHUB_CREDFILE

the credential file to use.

$GITHUB_ORG

the github organization that the project belongs to.

$GITHUB_REPO

the github repository of the project.

$REVER_CONFIG_DIR

the user’s config directory for rever, which is where the GitHub credential files are stored by default.

$CHANGELOG_LATEST

path to the latest release notes file created by the changelog activity.

$TAG_TEMPLATE

may used to find the tag name when creating the default asset.

Parameters
namestr, optional

Name of the activity.

depsset of str, optional

Set of activities that must be completed before this activity is executed.

funccallable, optional

Function to perform as activity when this activities is executed (called).

undocallable, optional

Function to undo this activities behaviour and reset the repo state.

setupcallable, optional

Function to help initialize the activity.

checkcallable, optional

Function to check if the activity can be run sucessfully on the user’s machine, with their credentials, etc. This function should return True if the activity can be run, and False otherwise.

requiresdict or None, optional

A dict of dicts of the following form that specifies the command line utility and import requirements for this activity.

{
    "commands": {"<cli name>": "<package name>", ...}
    "imports": {"<module name>": "<package name>", ...}
}

The top-level keys are both optional, and this will default to an empty dict.

argstuple, optional

Arguments to be supplied to the func(*args), if needed.

kwargsmapping, optional

Keyword arguments to be supplied to the func(**kwargs), if needed.

descstr, optional

A short description of this activity

all_kwargs()

Returns all kwargs for this activity.

check()

Calls this activity’s check() function.

check_func()
check_requirements()

Checks that an activities requirements are actually available.

checker(check)

Decorator that sets the check function for this activity.

clear_kwargs_from_env()

Removes kwarg from the environment, if they exist.

kwargs_from_env()

Obtains possible func() kwarg from the environment.

setup()

Calls this activity’s setup() initialization function.

setupper(setup)

Decorator that sets the setup function for this activity.

undo()

Reverts to the last instance of this activity. This default implementation uses the revision in the log file from the last time that the activity was started. This may be overridden in a subclass.

undoer(undo)

Decorator that sets the undo function for this activity.

property env_names

Dictionary mapping parameter names to the names of environment varaibles that the activity looks for when it is executed.

rever.activities.ghrelease.find_notes(notes)

Tries to find the release notes in a variety of places.

rever.activities.ghrelease.git_archive_asset()

Provides tarball of the repository as an asset.

rever.activities.ghrelease.read_file_if_exists(filename)

Reads file if it exists, returns None otherwise