logo
0
0
WeChat Login

git-auto-tag

An automatic TAG command based on the semantic-release analysis tool.

semantic-release uses the @semantic-release/commit-analyzer plugin to automatically analyze keywords in commit messages (such as feat:, fix:, perf:, etc.), and determine the type of version upgrade (major, minor, or patch). Default version upgrade rules If you want to customize version upgrade rules, you can configure the releaseRules parameter.

Using git-auto-tag requires the team to agree on a commit format, it is recommended to use it with commit-lint related plugins.

Parameters

message

  • type: string
  • default: "Release {tag name}"
  • required: No

The message added via -m when generating a tag, for example: git tag -a v0.0.1 -m "Release v0.0.1"

tagFormat

  • type: string
  • default: v${version}
  • required: No

Specify the tag format, where ${version} will be replaced by the generated tag. For example, if the tag is 1.2.3, then v${version} will be v1.2.3.

dryRun

  • type: boolean
  • default: false
  • required: No

Whether to only get the next version number and other variables, rather than actually generating a tag.

blockWhenFail

  • type: boolean
  • default: false
  • required: No

releaseRules

  • type: string
  • required: No

Read custom release rules from the specified file. If not specified, the default rules will be used, where only commit messages with feat, fix, and perf formats will generate a tag.

If you need to expand the release rules, you can customize releaseRules.

For details on how to configure rules, see the documentation

Example file release-rules.json:

[ { "type": "docs", "scope": "README", "release": "patch" }, { "type": "refactor", "scope": "core-*", "release": "minor" }, { "type": "refactor", "release": "patch" }, { "scope": "no-release", "release": false } ];

toFile

  • type: string
  • default: auto_tag.json
  • required: No

Specify a file to save the execution results, with the following fields

{ //`Object` with `version`, `gitTag` and `gitHead` // of the last release. lastRelease, //`Object` with `version`, `gitTag`, `gitHead` and `notes` // of the release being done. nextRelease, commits, releases, }

branch

  • type: string
  • default: main
  • required: No

The branch on which the tag is automatically generated. This branch is used to get the commit logs, and the tag is generated based on these commit logs.

repoUrlHttps

  • type: string
  • required: No
  • default: The value of remote.origin.url obtained from the git configuration via git config --list

The HTTPS address of the target repository

Output

{ tag, // Generated tag }

Usage in Cloud Native Build

# .cnb.yml main: push: - stages: - name: auto-tag image: cnbcool/git-auto-tag:latest settings: tagFormat: v\${version} toFile: tag_info.json dryRun: false blockWhenFail: false branch: $CNB_BRANCH repoUrlHttps: $CNB_REPO_URL_HTTPS exports: tag: NEW_TAG - name: show tag script: echo $NEW_TAG - name: show tag res script: cat tag_info.json

About

No description, topics, or website provided.
Language
JavaScript86.7%
Shell9.1%
Dockerfile4.2%