Skip to content

GitHub Extension

Intisy edited this page Apr 24, 2026 · 1 revision

GitHub Extension

The github { } block is the top-level extension registered by the plugin. It holds the access token, debug flag, and two nested sub-extensions.

Fields

Field Type Default Description
accessToken String, File, or Path null GitHub Personal Access Token, or a path to a file containing one
debug boolean false Enables verbose debug logging

Full syntax

github {
    accessToken = "ghp_YOUR_TOKEN_HERE"   // raw token string
    // accessToken = file("${System.getProperty('user.home')}/.github_token")  // or a file
    debug = false

    publish {
        // see Publishing-Releases
        owner       = "my-org"
        repo        = "my-repo"
        version     = "1.0.0"
        tag         = "v1.0.0"
        releaseName = "Release 1.0.0"
        jar         = file("build/libs/my-lib.jar")
    }

    resources {
        // see Resources-Extension
        repoUrl = "https://github.com/my-org/my-resources"
        branch  = "main"
        path    = "/"
    }
}

Access token resolution

The accessToken value is resolved at runtime:

  • If it looks like a file path (contains / or \, or has a file extension), the plugin reads the token from that file.
  • Otherwise the value is used directly as the token string.

Supported token formats:

  • GitHub Personal Access Token: starts with ghp_ or github_pat_
  • SSH private key: used for Git clone/pull operations (not for the GitHub REST API)

Relation to publishGithub { }

The publish { } block inside github { } and the top-level publishGithub { } block configure the same PublishExtension object. Either form can be used; mixing them is safe.

// These two are identical in effect:

publishGithub {
    version = "1.0.0"
}

github {
    publish {
        version = "1.0.0"
    }
}

Clone this wiki locally