Skip to content

Outputs the current/next major, minor, and patch version based on the given semver version.

License

Notifications You must be signed in to change notification settings

rickstaa/action-get-semver

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

action-get-semver

A simple action that returns the current/next major, minor, and patch version based on the given semver version.

Action test Depup Release Docker Image CI GitHub release (latest SemVer)

Inputs

inputs:
  bump_level:
    description: "Version bump level [major, minor, patch]."
    required: False
    default: "patch"
  verbose:
    description: "Print current and next version."
    required: False
    default: "false"
  frail:
    description: "Return exit code of 1 when no version tag is found."
    required: False
    default: "false"

Outputs

outputs:
  current_version:
    description: "The current version."
  next_version:
    description: "The next major version."
  error:
    descriptor: "Whether an error was encountered when retrieving the current semver."

Usage

name: release
on:
  push:
    branches:
      - main
jobs:
  check-version:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - uses: rickstaa/action-get-semver@v1
        id: get_semver
        with:
          bump_level: "minor"
      - name: Print current and next version
        run: |
          echo "Current version: ${{ steps.get_semver.outputs.current_version  }}"
          echo "Next version: ${{ steps.get_semver.outputs.next_version }}"

NOTE: This action requires the fetch-depth: 0 argument to be set in the actions/checkout@v3 step (see actions/checkout#fetch-all-history-for-all-tags-and-branches ).

Contributing

Feel free to open an issue if you have ideas on how to make this GitHub action better or if you want to report a bug! All contributions are welcome. 🚀 Please consult the contribution guidelines for more information.

Acknowledgement

This action serves as a wrapper around the bump package of @haya14busa.