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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) StringGets the ref from a branch name.(package private) voidConnects to GitHub API.voidexecute()Gets the "package_version" input.getMaintenanceBranchName(@NonNull String releaseVersion) Gets the maintenance branch name matching this release version.(package private) StringGets the release branch name.(package private) StringgetReleaseVersion(@NonNull Optional<String> packageVersion, @NonNull String releaseBranchName) Gets the release version.(package private) StringGets the run release branch name.(package private) com.vdurmont.semver4j.SemvergetSemverVersion(@NonNull String version) Gets the semver verison object from the given version.Gets the repository tags.(package private) StringGets the git tag from the version.(package private) booleanisLatestMajorMinorPatchVersion(@NonNull String version, @NonNull Collection<String> taggedVersions) Returnstrueif the version is the latest under major.minor.patch version scope,falseotherwise.(package private) booleanisLatestMajorMinorVersion(@NonNull String version, @NonNull Collection<String> taggedVersions) Returnstrueif the version is the latest under major.minor version scope,falseotherwise.(package private) booleanisLatestMajorVersion(@NonNull String version, @NonNull Collection<String> taggedVersions) Returnstrueif the version is the latest under major version scopes,falseotherwise.
-
Constructor Details
-
SemverReleaseVarsGitHubAction
public SemverReleaseVarsGitHubAction()
-
-
Method Details
-
execute
public void execute()- Specified by:
executein interfaceme.julb.sdk.github.actions.spi.GitHubActionProvider
-
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
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
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
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) Returnstrueif the version is the latest under major version scopes,falseotherwise.- Parameters:
version- the version.taggedVersions- the list of versions to check.- Returns:
trueif the version is the latest under major version scopes,falseotherwise.
-
isLatestMajorMinorVersion
boolean isLatestMajorMinorVersion(@NonNull @NonNull String version, @NonNull @NonNull Collection<String> taggedVersions) Returnstrueif the version is the latest under major.minor version scope,falseotherwise.- Parameters:
version- the version.taggedVersions- the list of versions to check.- Returns:
trueif the version is the latest under major.minor version scope,falseotherwise.
-
isLatestMajorMinorPatchVersion
boolean isLatestMajorMinorPatchVersion(@NonNull @NonNull String version, @NonNull @NonNull Collection<String> taggedVersions) Returnstrueif the version is the latest under major.minor.patch version scope,falseotherwise.- Parameters:
version- the version.taggedVersions- the list of versions to check.- Returns:
trueif the version is the latest under major.minor.patch version scope,falseotherwise.
-
gitTag
Gets the git tag from the version.- Parameters:
version- the version.- Returns:
- the git tag for the given version.
-
branchRef
Gets the ref from a branch name.- Parameters:
branchName- the branch name.- Returns:
- the ref for the given branch name.
-