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()voidOverride the single JAR file to upload.voidOverride the GitHub repository owner.voidOverride the GitHub repository name.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
-
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
-