actions-marketplace-validations/Generate version

A GitHub action for reading, bumping, generating, formatting applications versions in release pipelines.

View on GitHub

Trust Signals

Scorecard Score
not yet scored
Maintenance Recency
Stale
License
None
namedescriptionrequireddefault
version-sourceA source of a CURRENT_VERSION, might be: - file - variable yesvariable
versionA version variable for version sourceno
version-fileA path to a file with which holds a versionno
version-file-extraction-patternA RegEx to extract version from a version-source file. Should either match a full version, or return it as the first group. E.G: - '(?<=version=).+' - pattern match, e.g: 'version=5.0.3-SNAPSHOT' will extract matched string '5.0.3-SNAPSHOT' - '"version":\s*"([^"]+)"' - group match, will extract the first group. e.g: '"version": "1.0.0",' to '1.0.0' In case if there are groups in a pattern the first group will be extracted. no.+
release-version-cut-snapshotRemove "SNAPSHOT" suffix from source versionnotrue
release-version-cut-prereleaseRemove prerelease part from source versionnofalse
release-version-cut-build-metadataRemove build metadata suffix from source versionnotrue
release-version-generate-build-metadataPut build metadata (release date, commit sha, etc.) into result RELEASE_VERSIONnofalse
release-version-build-metadata-patternFormat pattern for build metadata. EG: "build.{date[YYYY-MM-dd]}.{hash[0, 6]}". It is also possible not to customize variable outputs omitting square braces ([]) or even not to use any variables. Supported variables: - date[date_format]: a current date in UTC or time set in 'release-version-build-metadata-datetime' variable. Supports formatting included in square braces ([]). The date format will be applied by "Moment.js". Default format is ['YYYY-MM-DD']. Library: https://momentjs.com/ - hash[begin_index_inclusive, end_index_exclusive]: a commit hash, which triggered this build. You can shorten the hash by specifying begin and end characters indexes included in square braces ([]), separated by a comma. Default begin, end values are: [0, 8]. nobuild.{date}.{hash}
release-version-build-metadata-datetimeA time stamp in ISO format to put into a build metadata string, by default the action uses current time in UTC timezoneno
next-version-increment-majorIncrement major version in result NEXT_VERSION, resets all other versions to "0" and prerelease to "1" if foundnofalse
next-version-increment-minorIncrement minor version in result NEXT_VERSION, resets patch to "0" and prerelease to "1" if foundnofalse
next-version-increment-patchIncrement patch version in result NEXT_VERSION, resets prerelease to "1" if foundnofalse
next-version-increment-prereleaseIncrement prerelease version in result NEXT_VERSIONnofalse
next-version-cut-prereleaseRemove prerelease part from source versionnofalse
next-version-cut-build-metadataRemove build metadata suffix from source versionnotrue
next-version-put-build-metadataPut build metadata (release date, commit sha, etc.) into result NEXT_VERSION. Will be the same as for RELEASE_VERSIONnofalse
data-extractEnable data extraction mechanism. Example: data-extract: true data-extract-name: 'first_variable' data-extract-paths: '/path/to/file' data-extract-patterns: '/(?<=variable.name=).+/i' There are several use cases depending on RegEx format and flags: * RegEx Match only - As on example, above. Variable name in 'data-extract-name' parameter will be used 'as is', variable value will be set on matched text. Extraction will fail if 'data-extract-name' is not set. * One group - Variable name in 'data-extract-name' parameter will be used 'as is', variable value will be set on group value. Extraction will fail if 'data-extract-name' is not set. * Two or more groups - If 'data-extract-name' value is set then the first group will be used as value, and other groups will be ignored, if it's not set, then the first group will used as variable name and the second group will be used as value. * Multiple match (multiple RegEx, 'g' flag in RegEx is set, etc) - If 'data-extract-name' value is set the action will extract all RegEx matches and export variables with underscore and variable index as suffix, except the first one. E.G.: first_variable -> FIRST_VARIABLE, FIRST_VARIABLE_1, etc; If 'data-extract-name' value is not set then two groups in every RegEx is a requirement, the first group will used as variable name and the second group will be used as value. If multiple files have the same variable names, output values will be overwritten with the latter matches. Variable name convert rules: * Spaces and symbols '-', even multiple in a row, will be converted to single symbol '_'; * Other special characters except digits and letters will be cut off; * The variable name will be converted to upper case. nofalse
data-extract-nameVariable name to which extracted data will be placed, standard variable name conversion rules are also applied to this field. If not set it will be extracted from RegEx groups. See usage use cases above. no
data-extract-pathsSemicolon (";") separated path list of files which to use to extract datano
data-extract-patternsSemicolon (";") separated RegEx pattern list wrapped with "/" symbols, with flagsno
namedescription
CURRENT_VERSIONA version grabbed from a variable or a file without any changes
RELEASE_VERSIONA version prepared for release tagging, usually with removed "SNAPSHOT" suffix and optionally with a build metadata
NEXT_VERSIONA version prepared for pushing into a repository instead of "CURRENT_VERSION" after release, usually incremented by 1