diff --git a/cmd/tag.go b/cmd/tag.go index 8c7f36c..c9e2ca0 100644 --- a/cmd/tag.go +++ b/cmd/tag.go @@ -82,7 +82,17 @@ Environment Variables: | | Must be used in conjunction with NSV_SHOW (default: full) | | NSV_SHOW | show how the next semantic version was generated | | NSV_TAG_MESSAGE | a custom message for the annotated tag, supports go text | -| | templates. The default is: "chore: tagged release {{.Tag}}" |` +| | templates. The default is: "chore: tagged release {{.Tag}}" | + +Hook Environment Variables: + +| Name | Description | +|-----------------------|-------------------------------------------------------------| +| NSV_NEXT_TAG | the next calculated semantic version | +| NSV_PREV_TAG | the last semantic version as identified within the tag | +| | history of the current repository | +| NSV_WORKING_DIRECTORY | the working directory (or path) relative to the root of the | +| | current repository. It will be empty if not a monorepo |` ) func tagCmd(opts *Options) *cobra.Command { diff --git a/internal/nsv/semver.go b/internal/nsv/semver.go index c3b78c8..d7a4fc7 100644 --- a/internal/nsv/semver.go +++ b/internal/nsv/semver.go @@ -259,7 +259,11 @@ func NextVersion(gitc *git.Client, opts Options) (*Next, error) { if diffs, err = execHook( gitc, opts.Hook, - []string{"NSV_PREV_TAG=" + ltag, "NSV_NEXT_TAG=" + nextVer}, + []string{ + "NSV_PREV_TAG=" + ltag, + "NSV_NEXT_TAG=" + nextVer, + "NSV_WORKING_DIRECTORY=" + ctx.LogPath, + }, opts.Logger, ); err != nil { return nil, err