Skip to content

EmilDafinov/sbt-github-release

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sbt Github release plugin

This is a simple sbt-plugin for creating Github releases with proper release notes and optional artifact uploading. It can be useful as a part of an automated release process.

Usage

SBT Dependency

To start using this plugin add the following to the project/plugins.sbt:

resolvers += "Jenkins repo" at "http://repo.jenkins-ci.org/public/"
addSbtPlugin("ohnosequences" % "sbt-github-release" % "<version>")

(see the latest release version on the badge above)

Note that since v0.5.0 this plugin is compiled and published only for sbt-1.0. If you need it for sbt-0.13, use v0.4.0.

Setting keys

Key Type Short description
ghreleaseRepoOrg String Github repository organization
ghreleaseRepoName String Github repository name
ghreleaseNotes TagName => String Release notes for the given tag
ghreleaseTitle TagName => String The title of the release
ghreleaseIsPrerelease TagName => Boolean A function to determine release as a prerelease based
ghreleaseAssets Seq[File] The artifact files to upload
ghreleaseMediaTypesMap File => String A function to determine media type for the assets

You can find their defaults in the plugin code.

Assets

You can set which files to attach to the release using the ghreleaseAssets task (of Seq[File] type). By default it refers to the packagedArtifacts task.

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.

By default 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 .jar and .pom files, you don't need to do anything.

If you don't want to upload any files, just set GithubRelease.ghreleaseAssets := Seq()

Task keys

The main task is githubRelease, it creates the release and publishes the assests.

There are some other tasks which work as intermediate checks:

  • ghreleaseGetCredentials — checks Github OAuth token and helps to set it if needed
  • ghreleaseGetRepo — checks that the repository exists and is accessible
  • ghreleaseGetReleaseBuilder — checks that Github repo contains the tag and there is no release based on it yet

Credentials

This plugin requires an OAuth token from your Github account. It should be placed in ~/.github:

oauth = 623454b0sd3645bdfdes541dd1fdg34504a8cXXX

But you don't need to create this file manually — when running githubRelease, plugin checks it and if there is no valid token, asks you to go and create one and then saves it.

About

An sbt plugin to publish releases on Github

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Scala 100.0%