Skip to content

A simple dotnet tool aiming for compatibility with the ruby `semver2` gem cli.

License

Notifications You must be signed in to change notification settings

Matthew-Davey/dotnet-semver

Repository files navigation

dotnet-semver

NuGet Version NuGet Downloads GitHub License


dotnet-semver is a dotnet re-implementation of the ruby semver2 gem cli.

Quickstart

Install

dotnet tool install -g dotnet-semver

Use

# Initialize the .semver file.
dotnet semver init

# Find the .semver file and print a formatted string from this.
dotnet semver                    # => v0.1.0

dotnet semver inc major          # => v1.0.0
dotnet semver inc minor          # => v1.1.0
dotnet semver pre "alpha.45"     # => v1.1.0-alpha.45
dotnet semver meta "md5.abc123"  # => v1.1.0-alpha.45+md5.abc123
dotnet semver format "%M.%m.x"   # => 1.1.x
dotnet semver meta               # => v1.1.0-alpha.45
dotnet semver inc minor          # => v1.2.0-alpha.45
cat .semver
---
:major: 0
:minor: 2
:patch: 0
:special: 'alpha.45'
:metadata: ''

Wrap dotnet CLI Commands

dotnet-semver can wrap the dotnet cli commands build, pack and publish, automatically adding the necessary version switch to the command line.

For example the command:

dotnet semver build --configuration Release

is executed as:

dotnet build /p:Version=1.2.0-alpha.45 --configuration Release

Git Integration

git config alias.semtag '!git tag -a $(dotnet semver tag) -m "tagging $(dotnet semver tag)"'

Usage

USAGE: dotnet semver [--help] [init [--force] | inc <version> | pre <value> | meta <value> | tag | next <version> | format <format>]

OPTIONS:
    --help - Display this list of options.
    -n     - Do not output the trailing newline.

SUBCOMMANDS:
    init[ialize] [--force] - Initializes a new .semver file with an initial version v0.1.0.
    inc[rement] <version>  - Increments the specified version number according to semver2 rules. <version> must be one of [major|minor|patch].
    pre[release] <value>   - Sets the pre-release version suffix.
    meta[data] <value>     - Sets the metadata value.
    next <version>         - Format incremented specific version without saving it. <version> must be one of [major|minor|patch].
    tag                    - Print the tag for the current .semver file.
    format [-n] <format>   - Find the .semver file and print a formatted string from this..
    
DOTNET CLI WRAPPERS:
    build [args]           - Executes dotnet build, passing the current semver as a switch.
    pack [args]            - Executes dotnet pack, passing the current semver as a switch.
    publish [args]         - Executes dotnet publish, passing the current semver as a switch.

Format String Tokens

  • Major: %M
  • Minor: %m
  • Patch: %p
  • Special: %s
  • Metadata: %d

Credits

About

A simple dotnet tool aiming for compatibility with the ruby `semver2` gem cli.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages