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
-
Method Summary
Modifier and TypeMethodDescription(package private) String
Gets the ref from a branch name.(package private) void
Connects to GitHub API.void
execute()
Gets the "package_version" input.getMaintenanceBranchName
(@NonNull String releaseVersion) Gets the maintenance branch name matching this release version.(package private) String
Gets the release branch name.(package private) String
getReleaseVersion
(@NonNull Optional<String> packageVersion, @NonNull String releaseBranchName) Gets the release version.(package private) String
Gets the run release branch name.(package private) com.vdurmont.semver4j.Semver
getSemverVersion
(@NonNull String version) Gets the semver verison object from the given version.Gets the repository tags.(package private) String
Gets the git tag from the version.(package private) boolean
isLatestMajorMinorPatchVersion
(@NonNull String version, @NonNull Collection<String> taggedVersions) Returnstrue
if the version is the latest under major.minor.patch version scope,false
otherwise.(package private) boolean
isLatestMajorMinorVersion
(@NonNull String version, @NonNull Collection<String> taggedVersions) Returnstrue
if the version is the latest under major.minor version scope,false
otherwise.(package private) boolean
isLatestMajorVersion
(@NonNull String version, @NonNull Collection<String> taggedVersions) Returnstrue
if the version is the latest under major version scopes,false
otherwise.
-
Constructor Details
-
SemverReleaseVarsGitHubAction
public SemverReleaseVarsGitHubAction()
-
-
Method Details
-
execute
public void execute()- Specified by:
execute
in 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) Returnstrue
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) Returnstrue
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) Returnstrue
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
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.
-