Class SemverReleaseVarsGitHubAction

java.lang.Object
me.julb.applications.github.actions.SemverReleaseVarsGitHubAction
All Implemented Interfaces:
me.julb.sdk.github.actions.spi.GitHubActionProvider

public class SemverReleaseVarsGitHubAction extends Object implements me.julb.sdk.github.actions.spi.GitHubActionProvider
The action to compute SemVer release vars.
Author:
Julb.
  • Constructor Details

    • SemverReleaseVarsGitHubAction

      public SemverReleaseVarsGitHubAction()
  • Method Details

    • execute

      public void execute()
      Specified by:
      execute in interface me.julb.sdk.github.actions.spi.GitHubActionProvider
    • getInputPackageVersion

      Optional<String> getInputPackageVersion()
      Gets the "package_version" input.
      Returns:
      the "package_version" input.
    • getReleaseBranchName

      String getReleaseBranchName()
      Gets the release branch name.
      Returns:
      the release branch name.
    • getRunReleaseBranchName

      String getRunReleaseBranchName()
      Gets the run release branch name.
      Returns:
      the run release branch name.
    • getReleaseVersion

      String getReleaseVersion(@NonNull @NonNull Optional<String> packageVersion, @NonNull @NonNull String releaseBranchName)
      Gets the release version.
      Parameters:
      packageVersion - the package version if any.
      releaseBranchName - the release branch name.
      Returns:
      the release version.
    • getSemverVersion

      com.vdurmont.semver4j.Semver getSemverVersion(@NonNull @NonNull String version)
      Gets the semver verison object from the given version.
      Parameters:
      version - the version.
      Returns:
      the semver object for that version.
      Throws:
      IllegalArgumentException - if the version is not semver-valid.
    • connectApi

      void connectApi() throws IOException
      Connects to GitHub API.
      Throws:
      IOException - if an error occurs.
    • getMaintenanceBranchName

      Optional<String> getMaintenanceBranchName(@NonNull @NonNull String releaseVersion) throws IOException
      Gets the maintenance branch name matching this release version.
      Parameters:
      releaseVersion - the release version.
      Returns:
      the maintenance branch name matching this release version, or Optional.empty() otherwise.
      Throws:
      IOException - if an error occurs.
    • getValidSemverTags

      Map<String,org.kohsuke.github.GHTag> getValidSemverTags() throws IOException
      Gets the repository tags.
      Returns:
      the tags of the given repository.
      Throws:
      IOException - if an error occurs.
    • isLatestMajorVersion

      boolean isLatestMajorVersion(@NonNull @NonNull String version, @NonNull @NonNull Collection<String> taggedVersions)
      Returns true if the version is the latest under major version scopes, false otherwise.
      Parameters:
      version - the version.
      taggedVersions - the list of versions to check.
      Returns:
      true if the version is the latest under major version scopes, false otherwise.
    • isLatestMajorMinorVersion

      boolean isLatestMajorMinorVersion(@NonNull @NonNull String version, @NonNull @NonNull Collection<String> taggedVersions)
      Returns true if the version is the latest under major.minor version scope, false otherwise.
      Parameters:
      version - the version.
      taggedVersions - the list of versions to check.
      Returns:
      true if the version is the latest under major.minor version scope, false otherwise.
    • isLatestMajorMinorPatchVersion

      boolean isLatestMajorMinorPatchVersion(@NonNull @NonNull String version, @NonNull @NonNull Collection<String> taggedVersions)
      Returns true if the version is the latest under major.minor.patch version scope, false otherwise.
      Parameters:
      version - the version.
      taggedVersions - the list of versions to check.
      Returns:
      true if the version is the latest under major.minor.patch version scope, false otherwise.
    • gitTag

      String gitTag(@NonNull @NonNull String version)
      Gets the git tag from the version.
      Parameters:
      version - the version.
      Returns:
      the git tag for the given version.
    • branchRef

      String branchRef(@NonNull @NonNull String branchName)
      Gets the ref from a branch name.
      Parameters:
      branchName - the branch name.
      Returns:
      the ref for the given branch name.