Git Product home page Git Product logo

github-release-gradle-plugin's Introduction

github-release

A Gradle Plugin to send Releases to Github

This plugin is not endorsed by Github.

This plugin uses OkHttp to send a POST requests to the github api that creates a release and uploads specified assets.

Changelog

2.2

  • Added more detailed information in wiki
  • This will no longer delete existing releases by default and must be specified with overwrite = true
  • Added ability to use username and password as shown here

Adding as a dependency

Gradle Plugin Page

Build script snippet for use in all Gradle versions:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.com.github.breadmoirai:github-release:2.2.0"
  }
}

apply plugin: "com.github.breadmoirai.github-release"

Build script snippet for new, incubating, plugin mechanism introduced in Gradle 2.1:

plugins {
  id "com.github.breadmoirai.github-release" version "2.2.0"
}

Using this plugin

githubRelease {
    token "your token"// This is your personal access token with Repo permissions
                        // You get this from your user settings > developer settings
                        // If this value is not set, a login dialog will prompt you for your credentials.
                        // 2fa is not supported
    owner "breadmoirai" // default is the last part of your group. Eg group: "com.github.breadmoirai" => owner: "breadmoirai"
    repo "github-release" // by default this is set to your project name
    tagName "v1.0.0" // by default this is set to "v${project.version}"
    targetCommitish "master" // by default this is set to "master"
    releaseName "v1.0.0" // Release title, by default this is the same as the tagName
    body "Wham, bam! Thank you clam!" // by default this is a list of commits from the current commit to the last commit associated with a github release
    draft false // by default this is false
    prerelease false // by default this is false
    releaseAssets jar.destinationDir.listFiles // this points to which files you want to upload as assets with your release
    override true // by default false; if set to true, will delete an existing release with the same tag and name
}

For additional info on these fields please see the Github API specification.

Additional Tips:

All properties except releaseAssets support using a closure to defer evaluation.

body {
    //do something intensive
    return "wow"
}

Body Changelog

By default, we provide a changelog when the body is not set via git commands. You can also customize it and or use it manually

body changelog {
    currentCommit "HEAD"
    lastCommit "HEAD~10"
    options(["--format=oneline", "--abbrev-commit", "--max-count=50", "graph"])
}
body { """\
# Info
...

## ChangeLog
${(changelog {}).get().replace('\n', '\n* ')}
""" }

Token

You can store your token in a gradle.properties located in either USER/.gradle or in the project directory and then retrieve it with getProperty('github.token')

Release Assets

You can avoid removing irrelevant files from your selected directory each time you publish a release by using a filter. For Example

FilenameFilter filter = { dir, filename -> filename.contains(project.version) }
releaseAssets = jar.destinationDir.listFiles filter

github-release-gradle-plugin's People

Contributors

bgpat avatar breadmoirai avatar fthevenet avatar stevecookform3 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.