Skip to main content

git-tag

The git-tag step creates a new, annotated tag in a local Git repository referencing the current HEAD of a checked-out branch.

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 tag to create.
messagestringYThe message with which to annotate the tag.
tagger.namestringNThe tagger's name. If unspecified, defaults to the repo-level configuration specified when the repo was cloned. Can also be configured at the system level.
tagger.emailstringNThe tagger's email address. If unspecified, defaults to the repo-level configuration specified when the repo was cloned. Can also be configured at the system level.
tagger.signingKeystringNThe GPG signing key for the tagger. If provided tagger.name and tagger.email must also be provided and must match the email and name in the uid of the associated GPG key.

Output

NameTypeDescription
commitstringThe ID (SHA) of the commit pushed by this step.

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

Creating A Signed Tag

In this example, the git-tag step creates a signed tag using the provided tagger.signingKey by sourcing it from an existing secret in the same namespace using the secret() expression function.

note

Tagger signing information may have been configured at the system level by a Kargo admin. If system-level configuration exists, the example shown below would override it.

steps:
- uses: git-tag
config:
path: ./out
tag: v1.0.0
message: My example tag
tagger:
name: Me
email: me@example.com
signingKey: ${{ secret('my-gpg-secret').privateKey }}
note

If tagger.signingKey is provided, but tagger.name and tagger.email do not match the key's UID, tagging will fail.