java.lang.Object
io.github.duckasteroid.gradle.versioning.releaseflow.ReleaseGitOps

public final class ReleaseGitOps extends Object
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 Type
    Method
    Description
    static void
    createAndPushTag(File repoDir, String tag)
    Creates an annotated tag at HEAD and pushes it to origin - the only state-mutating step here.
    static String
    The current branch name (e.g.
    static String
    relativePath(File base, File file)
    file's path relative to base, with forward slashes regardless of OS - for the JSON manifest.
    static String
    runGit(File repoDir, String... args)
    Plain ProcessBuilder rather than a live Project.exec (unsupported under the configuration cache from a task action at execution time) or JGit plumbing (pushing a tag needs real push credentials - the git CLI transparently reuses whatever's already configured, both locally and via actions/checkout's persisted GITHUB_TOKEN in CI, with no extra credential wiring needed here).
    static void
    writeChangelog(File outputFile, String changelog)
    Writes generated changelog Markdown to outputFile, creating parent directories as needed.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • writeChangelog

      public static void writeChangelog(File outputFile, String changelog)
      Writes generated changelog Markdown to outputFile, creating parent directories as needed.
    • createAndPushTag

      public static void createAndPushTag(File repoDir, String tag)
      Creates an annotated tag at HEAD and pushes it to origin - the only state-mutating step here.
    • relativePath

      public static String relativePath(File base, File file)
      file's path relative to base, with forward slashes regardless of OS - for the JSON manifest.
    • currentBranch

      public static String currentBranch(File repoDir)
      The current branch name (e.g. "release"), for explainVersion(s)' buildVersion computation (see VersionResolver.resolveBuildVersion's branchName parameter) - deliberately a plain git CLI call rather than JGit's own Repository.getBranch(), since this only ever runs from a doLast block (task execution time), where an external process is fine, and reusing runGit(java.io.File, java.lang.String...) here means there's exactly one place that shells out to git in this class.
    • runGit

      public static String runGit(File repoDir, String... args)
      Plain ProcessBuilder rather than a live Project.exec (unsupported under the configuration cache from a task action at execution time) or JGit plumbing (pushing a tag needs real push credentials - the git CLI transparently reuses whatever's already configured, both locally and via actions/checkout's persisted GITHUB_TOKEN in 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.