Skip to main content

git-tag

The git-tag step creates a new tag in a local Git repository. This step is commonly used to mark specific commits with a tag, which can be useful for versioning or tracking changes in a repository.

Configuration

NameTypeRequiredDescription
pathstringYPath to a working directory of a local repository. This path is relative to the temporary workspace that Kargo provisions for use by the promotion process.
tagstringYThe name of the tag to create.
providerstringNThe name of the Git provider to use. Currently 'azure', 'bitbucket', 'gitea', 'github', and 'gitlab' are supported. Kargo will try to infer the provider if it is not explicitly specified. This setting does not affect the push operation but helps generate the correct commitURL output when working with repositories where the provider cannot be automatically determined, such as self-hosted instances.

Output

NameTypeDescription
tagstringThe name of the tag that was created by this step. This can be referenced in subsequent steps.
commitstringThe ID (SHA) of the commit pushed by this step.
commitURLstringThe URL of the commit that was pushed to the remote repository.
caution

If the specified tag already exists in the remote repository, the git-tag step will fail.

Examples

Basic Usage

In this example, the git-tag step creates a tag named v1.0.0 in a local Git repository.

steps:
- uses: git-tag
config:
path: ./out
tag: v1.0.0

Tagging After a Commit

This example demonstrates how to use the git-tag step after a git-commit step to tag the latest commit with a version number.

steps:
- uses: git-commit
config:
path: ./out
message: "Committing changes for release v1.0.0"
- uses: git-tag
config:
path: ./out
tag: v1.0.0

Pushing After Tagging

In this example, the git-tag step creates a tag, and the git-push step pushes the tag to the remote repository.

steps:
- uses: git-tag
config:
path: ./out
tag: v1.0.0
- uses: git-push
config:
path: ./out
tag: v1.0.0