Sbt Github release plugin
To start using this plugin add the following to the
addSbtPlugin("ohnosequences" % "sbt-github-release" % "<version>")
(see the latest release version on the badge above)
Note that since
v0.5.0this plugin is compiled and published only for sbt-1.x. If you need it for sbt-0.13, use
The main task is
githubRelease, it creates the release and publishes the assets.
||Github repository organization|
||Github repository name|
||Release notes for the given tag|
||The title of the release|
||A function to determine release as a prerelease based|
||The artifact files to upload|
||A function to determine media type for the assets|
||OAuth credentials used to access Github API|
You can find their defaults in the plugin code.
Autodetect repository organization and name
By default, this plugin will try to auto-detect settings for
ghreleaseRepoName based on git remote with name
origin. If such remote not exist then plugin will fallback to sbt organization/name. If you would like to avoid auto-detect behavior you should set
You can set which files to attach to the release using the
ghreleaseAssets task (of
Seq[File] type). By default it refers to the
Note, that Github requires to set the media (MIME) type of each asset. You can customize which media types will be used through the
ghreleaseMediaTypesMap setting. Github documentation refers to IANA for the list of accepted types.
ghreleaseMediaTypesMap is set to the default Java
MimetypesFileTypeMap (with some modifications) which looks for the MIME types files in various places in your system. If you don't have any, you can download one and save it as
~/.mime.types. If you are uploading only
.pom files, you don't need to do anything.
If you don't want to upload any files, just set
GithubRelease.ghreleaseAssets := Seq()
This plugin requires an OAuth token with
repo scope to interact with Github API. Use this link to create it in your Github profile:
ghreleaseGithubToken looks for the token in the following places:
GITHUB_TOKENenvironment variable (using
~/.githubproperties file (using
githubTokenFromFile(...)shortcut). Expected file format is
oauth = 623454b0sd3645bdfdes541dd1fdg34504a8cXXX
You can use either of these two shortcuts (with
import ohnosequences.sbt.GithubRelease.defs._) or any other way to retrieve the token and set it explicitly.