-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: extend documentation to include new patch sub-command (#169)
- Loading branch information
1 parent
2bf7bb0
commit fa6b0db
Showing
11 changed files
with
217 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
icon: material/file-sign | ||
description: Adhere to best practice with commit or tag gpg signing | ||
social: | ||
cards: false | ||
--- | ||
|
||
# Git GPG signing | ||
|
||
If you require GPG signing, please ensure your git config is correct before running `nsv`. | ||
|
||
## Importing a GPG key | ||
|
||
[gpg-import](https://github.com/purpleclay/gpg-import) is a tool you can easily integrate into your CI workflow and only needs a single environment variable (`GPG_PRIVATE_KEY`) to import a GPG key and configure your git config. | ||
|
||
## Committer impersonation | ||
|
||
When tagging your repository, `nsv` will identify the person associated with the commit that triggered the release and dynamically passes these to `git` through the `user.name` and `user.email` config settings. | ||
|
||
Any of the following conditions will remove the need for impersonation: | ||
|
||
1. The repository has the `user.name` and `user.email` settings already defined in git config. | ||
1. The git environment variables `GIT_COMMITTER_NAME` and `GIT_COMMITTER_EMAIL` exist. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
icon: material/file-edit-outline | ||
description: Automatically patch files in your repository with the next semantic version | ||
status: new | ||
--- | ||
|
||
# Patch files with the next semantic version | ||
|
||
<span class="rounded-pill">:material-test-tube: experimental</span> | ||
|
||
Let `nsv` patch files in your repository with the next calculated semantic version by executing a custom hook: | ||
|
||
=== "ENV" | ||
|
||
```{ .sh .no-select } | ||
NSV_HOOK="./scripts/patch.sh" nsv patch | ||
``` | ||
|
||
=== "CLI" | ||
|
||
```{ .sh .no-select } | ||
nsv patch --hook "./scripts/patch.sh" | ||
``` | ||
|
||
Any file changes are committed with the default message `chore: patched files for release <version>`. | ||
|
||
!!! tip "Auto-patching is on the horizon." | ||
|
||
Soon, `nsv` will recognize standard project files and automatically patch them | ||
with the next semantic version. How cool is that! :material-sunglasses: | ||
|
||
## Signing your commit | ||
|
||
If you require GPG signing, you can configure it [here](./git-signing.md). | ||
|
||
## Using a custom commit message | ||
|
||
You can change the commit message. Support for Go templating provides extra [customization](./reference/templating.md#commit-message). | ||
|
||
=== "ENV" | ||
|
||
```{ .sh .no-select } | ||
NSV_COMMIT_MESSAGE="chore: bumped files to {{.Tag}}" nsv patch | ||
``` | ||
|
||
=== "CLI" | ||
|
||
```{ .sh .no-select } | ||
nsv patch --commit-message "chore: bumped files to {{.Tag}}" | ||
``` | ||
|
||
Resulting in a commit message of: | ||
|
||
```{ .text .no-select .no-copy } | ||
chore: bumped files to 0.2.0 | ||
``` | ||
|
||
## Version template customization | ||
|
||
Internally, `nsv` utilizes a go template to construct the next semantic version. Runtime customization of this template is available [here](./next-version.md#version-template-customization). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--- | ||
icon: material/console | ||
social: | ||
cards: false | ||
status: new | ||
--- | ||
|
||
# nsv patch | ||
|
||
```{ .text .no-select .no-copy } | ||
Patch files in a repository with the next semantic version based on the | ||
conventional commit history of your repository. | ||
Environment Variables: | ||
| Name | Description | | ||
|--------------------|--------------------------------------------------------| | ||
| LOG_LEVEL | the level of logging when printing to stderr | | ||
| | (default: info) | | ||
| NO_COLOR | switch to using an ASCII color profile within the | | ||
| | terminal | | ||
| NO_LOG | disable all log output | | ||
| NSV_COMMIT_MESSAGE | a custom message when committing file changes, | | ||
| | supports go text templates. The default is: "chore: | | ||
| | patched files for release {{.Tag}}" | | ||
| NSV_DRY_RUN | no changes will be made to the repository | | ||
| NSV_FORMAT | provide a go template for changing the default version | | ||
| | format | | ||
| NSV_HOOK | a user-defined hook that will be executed before any | | ||
| | file changes are committed with the next semantic | | ||
| | version | | ||
| NSV_MAJOR_PREFIXES | a comma separated list of conventional commit prefixes | | ||
| | or triggering a major semantic version increment | | ||
| NSV_MINOR_PREFIXES | a comma separated list of conventional commit prefixes | | ||
| | for triggering a minor semantic version increment | | ||
| NSV_PATCH_PREFIXES | a comma separated list of conventional commit prefixes | | ||
| | for triggering a patch semantic version increment | | ||
| NSV_PRETTY | pretty-print the output of the next semantic version | | ||
| | in a given format. The format can be one of either | | ||
| | full or compact. Must be used in conjunction with | | ||
| | NSV_SHOW (default: full) | | ||
| NSV_SHOW | show how the next semantic version was generated | | ||
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 | | ||
``` | ||
|
||
## Usage | ||
|
||
```{ .text .no-select .no-copy } | ||
nsv patch [<path>...] [flags] | ||
``` | ||
|
||
## Flags | ||
|
||
```{ .text .no-select .no-copy } | ||
-M, --commit-message string a custom message when committing file changes, | ||
supports go text templates (default "chore: | ||
patched files for release {{.Tag}}") | ||
--dry-run no changes will be made to the repository | ||
-f, --format string provide a go template for changing the default | ||
version format | ||
-h, --help help for tag | ||
--hook string a user-defined hook that will be executed before | ||
any file changes are committed with the next | ||
semantic version | ||
--major-prefixes strings a comma separated list of conventional commit | ||
prefixes for triggering a major semantic version | ||
increment | ||
--minor-prefixes strings a comma separated list of conventional commit | ||
prefixes for triggering a minor semantic version | ||
increment | ||
--patch-prefixes strings a comma separated list of conventional commit | ||
prefixes for triggering a patch semantic version | ||
increment | ||
-p, --pretty string pretty-print the output of the next semantic | ||
version in a given format. The format can be one | ||
of either full or compact. Must be used in | ||
conjunction with --show (default "full") | ||
-s, --show show how the next semantic version was generated | ||
``` | ||
|
||
## Global Flags | ||
|
||
```{ .text .no-select .no-copy } | ||
--log-level string the level of logging when printing to stderr | ||
(default "info") | ||
--no-color switch to using an ASCII color profile within the terminal | ||
--no-log disable all log output | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters