nsv
NSV (Next Semantic Version) is a convention-based semantic versioning tool that leans on thepower of conventional commits to make versioning your software a breeze!
There are many semantic versioning tools already out there! But they typically require some
configuration or custom scripting in your CI system to make them work. No one likes managing config;
it is error-prone, and the slightest tweak ultimately triggers a cascade of change across your projects.
Step in NSV. Designed to make intelligent semantic versioning decisions about your project without needing a
config file. Entirely convention-based, you can adapt your workflow from within your commit message.
The power is at your fingertips.
Installation
dagger install github.com/purpleclay/daggerverse/nsv@v0.10.0
Entrypoint
Return Type
Nsv !
Arguments
Name | Type | Description |
---|---|---|
src | Directory ! | a path to a directory containing the projects source code |
noLog | Boolean | silence all logging within nsv |
logLevel | Enum ! | the level of logging when printing to stderr (debug,info,warn,error,fatal) |
Example
dagger -m github.com/purpleclay/daggerverse/nsv@dcf4cc7865ada8433f601f728e4a019b68d1fe4e call \
--src DIR_PATH
func (m *myModule) example(src *Directory, logLevel ) *Nsv {
return dag.
Nsv(src, logLevel)
}
@function
def example(src: dagger.Directory, log_level: ) -> dag.Nsv:
return (
dag.nsv(src, log_level)
)
@func()
example(src: Directory, logLevel: ): Nsv {
return dag
.nsv(src, logLevel)
}
Types
Nsv 🔗
NSV dagger module
next() 🔗
Prints the next semantic version based on the commit history of your repository. Documentation on Go Template support can be found at: https://docs.purpleclay.dev/nsv/reference/templating/
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
format | String | - | provide a go template for changing the default version format |
majorPrefixes | [String ! ] | - | a comma separated list of conventional commit prefixes for triggering a major semantic version increment |
minorPrefixes | [String ! ] | - | a comma separated list of conventional commit prefixes for triggering a minor semantic version increment |
patchPrefixes | [String ! ] | - | a comma separated list of conventional commit prefixes for triggering a patch semantic version increment |
paths | [String ! ] | - | a list of relative paths of projects to analyze |
pretty | String | "full" | pretty-print the output of the next semantic version in a given format. Supported formats are (full, compact). Must be used in conjunction with the show flag |
show | Boolean | - | show how the next semantic version was calculated |
Example
dagger -m github.com/purpleclay/daggerverse/nsv@dcf4cc7865ada8433f601f728e4a019b68d1fe4e call \
--src DIR_PATH next
func (m *myModule) example(ctx context.Context, src *Directory, logLevel ) string {
return dag.
Nsv(src, logLevel).
Next(ctx)
}
@function
async def example(src: dagger.Directory, log_level: ) -> str:
return await (
dag.nsv(src, log_level)
.next()
)
@func()
async example(src: Directory, logLevel: ): Promise<string> {
return dag
.nsv(src, logLevel)
.next()
}
tag() 🔗
Tags the next semantic version based on the commit history of your repository. Includes experimental support for patching files through a custom hook. Documentation on Go Template support can be found at: https://docs.purpleclay.dev/nsv/reference/templating/
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
commitMessage | String | "chore: patched files for release {{.Tag}} {{.SkipPipelineTag}}" | a custom message when committing file changes, supports go text templates |
format | String | - | provide a go template for changing the default version format |
gpgPassphrase | Secret | - | an optional passphrase to unlock the GPG private key used for signing the tag |
gpgPrivateKey | Secret | - | a base64 encoded GPG private key (armored) used for signing the tag |
hook | String | - | a user-defined hook that will be executed before the repository is tagged with the next semantic version. Can be inline shell or a path to a script |
majorPrefixes | [String ! ] | - | a comma separated list of conventional commit prefixes for triggering a major semantic version increment |
minorPrefixes | [String ! ] | - | a comma separated list of conventional commit prefixes for triggering a minor semantic version increment |
patchPrefixes | [String ! ] | - | a comma separated list of conventional commit prefixes for triggering a patch semantic version increment |
paths | [String ! ] | - | a list of relative paths of projects to analyze |
pretty | String | "full" | pretty-print the output of the next semantic version in a given format. Supported formats are (full, compact). Must be used in conjunction with the show flag |
show | Boolean | - | show how the next semantic version was calculated |
tagMessage | String | "chore: tagged release {{.Tag}}" | a custom message for the tag, supports go text templates |
Example
dagger -m github.com/purpleclay/daggerverse/nsv@dcf4cc7865ada8433f601f728e4a019b68d1fe4e call \
--src DIR_PATH tag
func (m *myModule) example(ctx context.Context, src *Directory, logLevel ) string {
return dag.
Nsv(src, logLevel).
Tag(ctx)
}
@function
async def example(src: dagger.Directory, log_level: ) -> str:
return await (
dag.nsv(src, log_level)
.tag()
)
@func()
async example(src: Directory, logLevel: ): Promise<string> {
return dag
.nsv(src, logLevel)
.tag()
}
patch() 🔗
Patch files in a repository with the next semantic version based on the conventional commit history of your repository. Documentation on Go Template support can be found at: https://docs.purpleclay.dev/nsv/reference/templating/
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
commitMessage | String | "chore: patched files for release {{.Tag}}" | a custom message when committing file changes, supports go text templates |
format | String | - | provide a go template for changing the default version format |
gpgPassphrase | Secret | - | an optional passphrase to unlock the GPG private key used for signing the tag |
gpgPrivateKey | Secret | - | a base64 encoded GPG private key (armored) used for signing the tag |
hook | String | - | a user-defined hook that will be executed before the repository is tagged with the next semantic version. Can be inline shell or a path to a script |
majorPrefixes | [String ! ] | - | a comma separated list of conventional commit prefixes for triggering a major semantic version increment |
minorPrefixes | [String ! ] | - | a comma separated list of conventional commit prefixes for triggering a minor semantic version increment |
patchPrefixes | [String ! ] | - | a comma separated list of conventional commit prefixes for triggering a patch semantic version increment |
paths | [String ! ] | - | a list of relative paths of projects to analyze |
pretty | String | "full" | pretty-print the output of the next semantic version in a given format. Supported formats are (full, compact). Must be used in conjunction with the show flag |
show | Boolean | - | show how the next semantic version was calculated |
Example
dagger -m github.com/purpleclay/daggerverse/nsv@dcf4cc7865ada8433f601f728e4a019b68d1fe4e call \
--src DIR_PATH patch
func (m *myModule) example(ctx context.Context, src *Directory, logLevel ) string {
return dag.
Nsv(src, logLevel).
Patch(ctx)
}
@function
async def example(src: dagger.Directory, log_level: ) -> str:
return await (
dag.nsv(src, log_level)
.patch()
)
@func()
async example(src: Directory, logLevel: ): Promise<string> {
return dag
.nsv(src, logLevel)
.patch()
}