/semver-info-action

Cleans, parses, and compares semantic versions, providing essential insights into versioning, stability, and compatibility, making software release management a breeze!

Primary LanguageTypeScriptISC LicenseISC

Semver Info Action

Cleans, parses, and compares semantic versions, providing essential insights into versioning, stability, and compatibility, making software release management a breeze!

Build Maintainable Coverage Issues Commit License Tag Size Label Label Licenses

Features

Usage

# RUNNER
- name: "Read Semver Info"
  id: "semver_info"
  uses: YunaBraska/semver-info-action@main

  # CONFIGS (Optional)
  with:
    semver-a: 'v1.2.3-rc.4'
    semver-b: 'v5.6.7-rc.8'
    fallBack-semver-a: '0.0.1'
    fallBack-semver-b: '0.0.1'
    increase-a: 'none'
    increase-b: 'none'

  # PRINT
- name: "Print Semver Info"
  run: |
    echo "clean_semver         [${{ steps.semver_info.outputs.clean_semver }}]"
    echo "is_stable            [${{ steps.semver_info.outputs.is_stable }}]"
    echo "is_valid_semver      [${{ steps.semver_info.outputs.is_valid_semver }}]"
    echo "is_major_change      [${{ steps.semver_info.outputs.is_major_change }}]"
    echo "is_a_greater_than_b  [${{ steps.semver_info.outputs.is_greater_a }}]"
    echo "next_major           [${{ steps.semver_info.outputs.next_major }}]"
    echo "next_major_a         [${{ steps.semver_info.outputs.next_major_a }}]"
    echo "next_major_b         [${{ steps.semver_info.outputs.next_major_b }}]"
    echo "next_minor           [${{ steps.semver_info.outputs.next_minor }}]"
    echo "next_patch           [${{ steps.semver_info.outputs.next_patch }}]"
    echo "next_rc              [${{ steps.semver_info.outputs.next_rc }}]"

Inputs

parameter Example Default Description
semver-a v1.2.3-rc.4 null Semver A to process
semver-b v5.6.7-rc.8 null Semver B to process - will be compared against the first semver
fallBack-semver-a 0.0.1 null The fallback version A in case version A is not valid
fallBack-semver-b 0.0.1 null The fallback version B in case version B is not valid
increase-a major null Increase version A before processing [major, minor, patch, rc]
increase-b patch null Increase version B before processing [major, minor, patch, rc]
null-to-empty true true Replaces null values with empty strings
use-version-txt true false Overwrites input semver-b with the version from version.txt file - if the file exists and the version is valid

Outputs

Name Example Default Description
clean_semver 5.6.7-rc.8 null The cleaned and normalized version without any prefix (highest semver wins)
clean_semver_a 1.2.3-rc.4 null The cleaned and normalized version A without any prefix
clean_semver_b 5.6.7-rc.8 null The cleaned and normalized version B without any prefix
is_greater_a false false Whether A is greater than B
is_smaller_a true false Whether A is smaller than B
is_greater_b true false Whether B is greater than A
is_smaller_b false false Whether B is smaller than A
change_type major null Diff A and B change [major, minor, patch, rc]
is_major_change true false If diff A and B is a major change
is_minor_change false false If diff A and B is a minor change
is_patch_change false false If diff A and B is a patch change
is_rc_change false false If diff A and B is a rc (release candidate) change
is_valid_semver true false Whether the semver is valid (highest semver wins)
is_valid_semver_a true false Whether semver A is valid
is_valid_semver_b true false Whether semver B is valid
is_stable false false Whether the version is stable (doesn't contain any pre-release tag) (highest semver wins)
is_stable_a false false Whether version A is stable (doesn't contain any pre-release tag)
is_stable_b false false Whether version B is stable (doesn't contain any pre-release tag)
major 5 null The major version of provided semver (highest semver wins)
major_a 1 null The major version of A
major_b 5 null The major version of B
minor 6 null The minor version of provided semver (highest semver wins)
minor_a 2 null The minor version of A
minor_b 6 null The minor version of B
patch 7 null The patch version of provided semver (highest semver wins)
patch_a 3 null The patch version of A
patch_b 7 null The patch version of B
rc 8 null The release candidate version of provided semver (highest semver wins)
rc_a 4 null The release candidate version of A
rc_b 8 null The release candidate version of B
rc_str rc null The prefix of the release candidate version (highest semver wins)
rc_str_a rc null The prefix of the release candidate version of A
rc_str_b rc null The prefix of the release candidate version of B
next_major 6.0.0 null The next major version of provided semver (highest semver wins)
next_major_a 2.0.0 null The next major version of A
next_major_b 6.0.0 null The next major version of B
next_minor 6.0.0 null The next minor version of provided semver (highest semver wins)
next_minor_a 2.0.0 null The next minor version of A
next_minor_b 6.0.0 null The next minor version of B
next_patch 6.0.0 null The next patch version of provided semver (highest semver wins)
next_patch_a 2.0.0 null The next patch version of A
next_patch_b 6.0.0 null The next patch version of B
next_rc 6.0.0 null The next rc version of provided semver (highest semver wins)
next_rc_a 2.0.0 null The next rc version of A
next_rc_b 6.0.0 null The next rc version of B
original-semver-a v1.2.3-rc.4 null Semver A to process
original-semver-b v5.6.7-rc.8 null Semver B to process - will be compared with first semver
fallBack-semver-a 0.0.1 null The fallback version A in case the original version A is not valid
fallBack-semver-b 0.0.1 null The fallback version B in case the original version B is not valid
version_txt 1.2.3 null semver from version file
version_txt_path /project/version.txt null path of version file

[DEV] Setup Environment

  • Build: npm run build to "compile" index.ts to ./lib/index.js
  • Test: npm run test
  • clean environment: ./clean_node.sh
  • Hint: please do not remove the node modules as they are required for custom GitHub actions :(