Class PublishExtension
java.lang.Object
io.github.intisy.gradle.github.extension.PublishExtension
Extension for configuring the
publishGithub task.
All fields are optional and fall back to auto-detection when null:
owner/repo— parsed from the git remoteoriginURLversion— taken fromproject.versionjar— the shadow/fat JAR inbuild/libs/, or the first regular JAR
Single-JAR shorthand (backward-compatible):
publishGithub {
owner = "my-org"
repo = "my-repo"
version = "2.0.0"
jar = file("build/libs/my-lib.jar")
}
Multi-JAR with classifiers:
publishGithub {
artifacts {
artifact { classifier = ""; jar = file("build/libs/my-lib.jar") }
artifact { classifier = "api"; jar = file("build/libs/my-lib-api.jar") }
artifact { classifier = "fat"; jar = file("build/libs/my-lib-fat.jar") }
}
}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidartifact(groovy.lang.Closure<?> closure) Adds a single artifact entry, configured by the given Groovy closure.voidartifact(org.gradle.api.Action<? super ArtifactEntry> action) Adds a single artifact entry, configured by the given Gradle action.voidartifacts(groovy.lang.Closure<?> closure) Opens a Groovy-DSL configuration block for multiple artifact entries.voidartifacts(org.gradle.api.Action<? super PublishExtension> action) Opens a configuration block in which multipleartifact(org.gradle.api.Action<? super io.github.intisy.gradle.github.extension.ArtifactEntry>)calls can be made.Returns the list of explicit artifacts to upload.getJar()getOwner()getRepo()getTag()voidOverride the single JAR file to upload.voidOverride the GitHub repository owner.voidsetReleaseName(String releaseName) Override the human-readable release title shown on GitHub.voidOverride the GitHub repository name.voidOverride the git tag pushed to GitHub for this release.voidsetVersion(String version) Override the release version tag.
-
Constructor Details
-
PublishExtension
public PublishExtension()
-
-
Method Details
-
setOwner
Override the GitHub repository owner. When null (default) the owner is auto-detected from the git remote origin.- Parameters:
owner- the repository owner
-
getOwner
- Returns:
- the overridden owner, or null to auto-detect
-
setRepo
Override the GitHub repository name. When null (default) the repo name is auto-detected from the git remote origin.- Parameters:
repo- the repository name
-
getRepo
- Returns:
- the overridden repo name, or null to auto-detect
-
setVersion
Override the release version tag. When null (default) the version is taken fromproject.version.- Parameters:
version- the version tag to use for the GitHub release
-
getVersion
- Returns:
- the overridden version, or null to use
project.version
-
setTag
Override the git tag pushed to GitHub for this release. When null (default) the tag equalsgetVersion()(after fallback toproject.version). Use this to prefix or format the tag independently of the version string, e.g.tag = "v1.0"whileversion = "1.0".- Parameters:
tag- the tag name, e.g."v2.0.0"
-
getTag
- Returns:
- the overridden tag, or null to use the resolved version string
-
setReleaseName
Override the human-readable release title shown on GitHub. When null (default) the title equals the resolved tag. Use this to set a descriptive name, e.g.releaseName = "Release 1.0".- Parameters:
releaseName- the release title
-
getReleaseName
- Returns:
- the overridden release title, or null to use the resolved tag
-
setJar
Override the single JAR file to upload. Ignored whengetArtifacts()is non-empty. When null (default) the task auto-selects the shadow/fat JAR frombuild/libs/, or falls back to the first regular JAR found there.- Parameters:
jar- the JAR file to upload
-
getJar
- Returns:
- the overridden JAR file, or null to auto-select
-
getArtifacts
Returns the list of explicit artifacts to upload. When non-empty this list takes precedence over the singlegetJar()field.- Returns:
- mutable list of
ArtifactEntryinstances
-
artifact
Adds a single artifact entry, configured by the given Gradle action.- Parameters:
action- action that receives and configures anArtifactEntry
-
artifact
public void artifact(groovy.lang.Closure<?> closure) Adds a single artifact entry, configured by the given Groovy closure.- Parameters:
closure- closure that configures anArtifactEntry
-
artifacts
Opens a configuration block in which multipleartifact(org.gradle.api.Action<? super io.github.intisy.gradle.github.extension.ArtifactEntry>)calls can be made. This is a convenience wrapper so users can writeartifacts { artifact { } }.- Parameters:
action- action that callsartifact(org.gradle.api.Action<? super io.github.intisy.gradle.github.extension.ArtifactEntry>)one or more times on this extension
-
artifacts
public void artifacts(groovy.lang.Closure<?> closure) Opens a Groovy-DSL configuration block for multiple artifact entries.- Parameters:
closure- closure in whichartifact { }calls are made
-