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 SummaryConstructors
- 
Method SummaryModifier 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- 
SemverReleaseVarsGitHubActionpublic SemverReleaseVarsGitHubAction()
 
- 
- 
Method Details- 
executepublic void execute()- Specified by:
- executein interface- me.julb.sdk.github.actions.spi.GitHubActionProvider
 
- 
getInputPackageVersionGets the "package_version" input.- Returns:
- the "package_version" input.
 
- 
getReleaseBranchNameString getReleaseBranchName()Gets the release branch name.- Returns:
- the release branch name.
 
- 
getRunReleaseBranchNameString getRunReleaseBranchName()Gets the run release branch name.- Returns:
- the run release branch name.
 
- 
getReleaseVersionString 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.
 
- 
getSemverVersionGets 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.
 
- 
connectApiConnects to GitHub API.- Throws:
- IOException- if an error occurs.
 
- 
getMaintenanceBranchNameOptional<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.
 
- 
getValidSemverTagsGets the repository tags.- Returns:
- the tags of the given repository.
- Throws:
- IOException- if an error occurs.
 
- 
isLatestMajorVersionboolean 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.
 
- 
isLatestMajorMinorVersionboolean 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.
 
- 
isLatestMajorMinorPatchVersionboolean 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.
 
- 
gitTagGets the git tag from the version.- Parameters:
- version- the version.
- Returns:
- the git tag for the given version.
 
- 
branchRefGets the ref from a branch name.- Parameters:
- branchName- the branch name.
- Returns:
- the ref for the given branch name.
 
 
-