Class ReleaseGitOps
java.lang.Object
io.github.duckasteroid.gradle.versioning.releaseflow.ReleaseGitOps
Plain-file/process helpers for
ReleaseFlowPlugin's doLast blocks - changelog writing,
tagging/pushing via the git CLI, and the manifest's relative-path formatting.
Under the configuration cache, a doLast action is serialized at store time and rebuilt at execution time - capturing everything it needs as plain local values (File/String, never live `Project` references) up front, and calling only into plain static methods like these, is what keeps that safe. This mirrors the equivalent discipline in the original Groovy plugin, just expressed as ordinary Java method calls from a lambda instead of a script's doLast closure.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcreateAndPushTag(File repoDir, String tag) Creates an annotated tag at HEAD and pushes it toorigin- the only state-mutating step here.static StringcurrentBranch(File repoDir) The current branch name (e.g.static StringrelativePath(File base, File file) file's path relative to base, with forward slashes regardless of OS - for the JSON manifest.static StringPlainProcessBuilderrather than a liveProject.exec(unsupported under the configuration cache from a task action at execution time) or JGit plumbing (pushing a tag needs real push credentials - thegitCLI transparently reuses whatever's already configured, both locally and viaactions/checkout's persistedGITHUB_TOKENin CI, with no extra credential wiring needed here).static voidwriteChangelog(File outputFile, String changelog) Writes generated changelog Markdown to outputFile, creating parent directories as needed.
-
Method Details
-
writeChangelog
Writes generated changelog Markdown to outputFile, creating parent directories as needed. -
createAndPushTag
Creates an annotated tag at HEAD and pushes it toorigin- the only state-mutating step here. -
relativePath
file's path relative to base, with forward slashes regardless of OS - for the JSON manifest. -
currentBranch
The current branch name (e.g. "release"), for explainVersion(s)' buildVersion computation (seeVersionResolver.resolveBuildVersion's branchName parameter) - deliberately a plaingitCLI call rather than JGit's ownRepository.getBranch(), since this only ever runs from a doLast block (task execution time), where an external process is fine, and reusingrunGit(java.io.File, java.lang.String...)here means there's exactly one place that shells out to git in this class. -
runGit
PlainProcessBuilderrather than a liveProject.exec(unsupported under the configuration cache from a task action at execution time) or JGit plumbing (pushing a tag needs real push credentials - thegitCLI transparently reuses whatever's already configured, both locally and viaactions/checkout's persistedGITHUB_TOKENin CI, with no extra credential wiring needed here). Returns stdout+stderr (merged) so callers that need the output (e.g.currentBranch(java.io.File)) don't need their own ProcessBuilder plumbing.
-