diff --git a/README.md b/README.md index 25c6ac9..35d12c1 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ uses: actions/checkout@v2 - name: Get next version - uses: reecetech/version-increment@2022.2.3 + uses: reecetech/version-increment@2022.2.4 id: version with: scheme: semver @@ -88,6 +88,12 @@ Examples: | current-v-version | The current latest version detected from the git repositories tags, prefixed with a `v` character | | version | The incremented version number (e.g. the next version) | | v-version | The incremented version number (e.g. the next version), prefixed with a `v` character | +| major-version | Major number of the incremented version | +| minor-version | Minor number of the incremented version | +| patch-version | Patch number of the incremented version | +| major-v-version | Major number of the incremented version, prefixed with a `v` character | +| minor-v-version | Minor number of the incremented version, prefixed with a `v` character | +| patch-v-version | Patch number of the incremented version, prefixed with a `v` character | ## 💕 Contributing diff --git a/action.yml b/action.yml index e157f87..3e496a1 100644 --- a/action.yml +++ b/action.yml @@ -32,6 +32,24 @@ outputs: v-version: description: 'Incremented version calculated, prefixed with a `v` charatcter' value: ${{ steps.version-increment.outputs.v-version }} + major-version: + description: 'Major number of the incremented version' + value: ${{ steps.version-increment.outputs.major-version }} + minor-version: + description: 'Minor number of the incremented version' + value: ${{ steps.version-increment.outputs.minor-version }} + patch-version: + description: 'Patch number of the incremented version' + value: ${{ steps.version-increment.outputs.patch-version }} + major-v-version: + description: 'Major number of the incremented version, prefixed with a `v` charatcter' + value: ${{ steps.version-increment.outputs.major-v-version }} + minor-v-version: + description: 'Minor number of the incremented version, prefixed with a `v` charatcter' + value: ${{ steps.version-increment.outputs.minor-v-version }} + patch-v-version: + description: 'Patch number of the incremented version, prefixed with a `v` charatcter' + value: ${{ steps.version-increment.outputs.patch-v-version }} runs: using: "composite" diff --git a/tests/test_version-increment.bats b/tests/test_version-increment.bats index 3f638d3..457e815 100644 --- a/tests/test_version-increment.bats +++ b/tests/test_version-increment.bats @@ -75,6 +75,9 @@ function init_repo { print_run_info [ "$status" -eq 0 ] && + [[ "$output" = *"::set-output name=major-version::1"* ]] && + [[ "$output" = *"::set-output name=minor-version::2"* ]] && + [[ "$output" = *"::set-output name=patch-version::4"* ]] && [[ "$output" = *"::set-output name=version::1.2.4"* ]] } @@ -88,6 +91,9 @@ function init_repo { print_run_info [ "$status" -eq 0 ] && + [[ "$output" = *"::set-output name=major-version::1"* ]] && + [[ "$output" = *"::set-output name=minor-version::3"* ]] && + [[ "$output" = *"::set-output name=patch-version::0"* ]] && [[ "$output" = *"::set-output name=version::1.3.0"* ]] } @@ -101,6 +107,9 @@ function init_repo { print_run_info [ "$status" -eq 0 ] && + [[ "$output" = *"::set-output name=major-version::2"* ]] && + [[ "$output" = *"::set-output name=minor-version::0"* ]] && + [[ "$output" = *"::set-output name=patch-version::0"* ]] && [[ "$output" = *"::set-output name=version::2.0.0"* ]] } @@ -115,6 +124,9 @@ function init_repo { print_run_info [ "$status" -eq 0 ] && [[ "$output" = *"::set-output name=version::2.0.0"* ]] && + [[ "$output" = *"::set-output name=major-v-version::v2"* ]] && + [[ "$output" = *"::set-output name=minor-v-version::v0"* ]] && + [[ "$output" = *"::set-output name=patch-v-version::v0"* ]] && [[ "$output" = *"::set-output name=v-version::v2.0.0"* ]] } diff --git a/version-increment.sh b/version-increment.sh index f8c29b7..278d38b 100755 --- a/version-increment.sh +++ b/version-increment.sh @@ -88,3 +88,9 @@ echo "â„šī¸ The new version is ${new_version}" echo "::set-output name=version::${new_version}" echo "::set-output name=v-version::v${new_version}" +echo "::set-output name=major-version::${version_array[0]}" +echo "::set-output name=minor-version::${version_array[1]}" +echo "::set-output name=patch-version::${version_array[2]}" +echo "::set-output name=major-v-version::v${version_array[0]}" +echo "::set-output name=minor-v-version::v${version_array[1]}" +echo "::set-output name=patch-v-version::v${version_array[2]}"