xx
.md

git_tag

git_tag creates a tag in an existing project-relative Git repository and returns a dependency. It creates a lightweight tag unless message is provided. Repeated creation at the same target succeeds without changing the existing tag.

Tag signing requires a go-git object-signer plugin, which xx does not currently provide; disable tag.gpgSign when creating annotated tags.

Arguments

ArgumentRequiredDescription
nameYesTag name without the refs/tags/ prefix.
repositoryNoProject-relative Git repository directory. Defaults to ..
revisionNoCommit revision to tag. Defaults to HEAD.
messageNoAnnotation message. Providing it creates an annotated tag.
tagger_nameNoAnnotated tagger name. Must be used with tagger_email and message. Defaults to Git configuration.
tagger_emailNoAnnotated tagger email. Must be used with tagger_name and message. Defaults to Git configuration.
forceNoReplace an existing tag, including one at the same target. Defaults to False.
depsNoDependencies to complete before creating the tag.

Example

load("@git@1", "git_commit", "git_push", "git_tag")

commit = git_commit(
    repository=".xx/output",
    message="Prepare release",
    deps=[generate],
)

tag = git_tag(
    repository=".xx/output",
    name="v1.0.0",
    message="Release v1.0.0",
    deps=[commit],
)

git_push(
    repository=".xx/output",
    tags=True,
    deps=[tag],
)