v0.3.2

Documentation version

v0.2.4v0.3.2
en

Documentation language

en

Search documentation

ESC

Documentation search

What are you working on?

Find a guide, configuration option, action, or ESH topic.

Browse documentation
DocsGit release action

Git release action

evin/git-release@v1 turns prepared repository changes into one local commit and can attach one annotated tag. With push configured it also publishes the branch and tag. It does not calculate a version, edit files, create a hosted release or review request, or upload artifacts.

mermaid
mermaid

all

existing

resolve commit message

stage mode

virtual or real git add -A

keep current index

require staged changes

verify user.name and user.email

resolve and preflight optional tag

create commit

create optional annotated tag

Configuration

Unknown fields are rejected.

with fieldTypeDefaultImplemented contract
stageall or existingallall stages with git add -A; existing requires and uses the current index without staging other worktree changes.
messagestringrepository policy release messageOptional non-empty pipeline template used as the commit message.
tagstringnoneOptional non-empty pipeline template for a tag name.
enabledboolean or templatetrueWhen false (or a template resolving to false, such as ${release:bump.changed}), succeed without staging, committing, tagging, or pushing and publish committed: false.
pushobjectnoneOptional publishing after a successful commit and tag; see Publishing refs.

Both optional strings receive template-syntax validation. Runtime templates can read values, environment variables, and outputs from prerequisite tasks.

tasks:
  bump:
    stage: Release
    steps:
      - uses: evin/version-bumper@v1
        with:
          files: [Cargo.toml]

  release:
    stage: Release
    needs: [bump]
    steps:
      - uses: evin/git-release@v1
        with:
          stage: all
          message: "chore(release): ${bump.version}"
          tag: "${bump.tag}"

If message is absent, the action uses releases.commit_message from the resolved repository policy. It fails when neither source supplies a message.

Choosing a staging boundary

ModeWhat enters the commitPreconditionMain risk
existingOnly changes already in the Git indexAt least one staged change must existA required release file can be omitted if it was not staged
allEvery tracked modification/deletion and every untracked file visible to git add -AThe worktree or index must contain a changeUnrelated worktree files can enter the release commit

Use existing when an earlier command deliberately assembled a reviewable index:

git add Cargo.toml Cargo.lock CHANGELOG.md
evin run release

Use all only when the task owns the complete worktree state. The default is all, so choose existing explicitly when isolation is required.

Commit and tag policy

Before mutation, the action verifies that user.name and user.email are available from Git configuration. Commit creation passes authorship.policies.require_signatures to the Git provider; when enabled, Git is invoked with -S.

If tag is configured, the action resolves it, checks it with git check-ref-format, and rejects an existing tag before it creates the commit. After a successful commit it runs the equivalent of:

git tag -a <tag> -m <commit-message>

The tag is annotated but is not created with Git's signed-tag flag. Without push, the action does not consult a remote or test whether the branch can be pushed.

Publishing refs

push is opt-in. Without it the action stays local.

push fieldTypeDefaultContract
remotestringoriginRemote that receives the refs.
branchstringcurrent branchBranch to push to the remote under the same name.
forcebooleanfalseUse git push --force for the branch and tag, for bot-maintained branches that are rebuilt each run.
prune_stale_tagsbooleanfalseAfter pushing, delete remote tags that match the repository policy tag format, are not the new tag, and whose commit is not reachable from <remote>/<base>. Requires tag and base. Tags whose commit is missing from the local repository are left alone; the local tag ref itself is not needed.
basestringnoneBranch whose remote-tracking ref (refs/remotes/<remote>/<base>, fetch it first) defines which tags are released. Valid only with prune_stale_tags.

The push runs after the commit and tag, so a rejected push leaves the local commit and tag intact and reports that the push can be retried. Dry runs report the push (and tag-pruning) plan without contacting the remote.

Failure and recovery boundaries

  1. Check configuration and staged changes. The action stops before changing history if the message is unavailable or the selected staging mode produces no staged change.

  2. Check identity and tag availability. It verifies the Git identity, validates the optional tag name, and rejects an existing tag.

  3. Create the commit. The commit can be signed according to repository policy.

  4. Create the annotated tag. When configured, the action uses the commit message for the tag.

The staging phase itself is a mutation in normal execution. A later identity or tag-preflight error can therefore leave files staged even though no commit was created.

Commit and tag creation are separate Git operations. If the commit succeeds but tagging fails, the commit remains at HEAD. The action reports the commit ID, intended tag, and Git error in a recovery diagnostic; it does not reset or amend history automatically.

Dry runs

The Git provider virtualizes git add, commit, and tag creation. A dry run still:

  • resolves the message and optional tag templates;

  • checks for staged or worktree changes according to stage;

  • verifies Git identity;

  • validates the tag name and checks the real repository for an existing tag;

  • honors virtual file changes produced by earlier dry-run steps when stage: all is used.

No real commit or tag is created. The action itself does not mark this plan unverified. If a tag is configured, the virtual tag operation succeeds and the action publishes the resolved tag output.

Outputs

OutputAvailabilityMeaning
tagA configured tag reaches successful normal or virtual tag creationResolved local tag name
committedAlways, unless the step failstrue after a release commit, false when enabled resolved to false

There is no commit-SHA output and no output when tag is omitted. A dependent task that needs the commit ID can run git rev-parse HEAD after this task.

Use evin/version-bumper@v1 when one action should discover the next semantic version, update files, and optionally perform the commit and tag. Use this action when those preparations are deliberately separate.

action.evin/git-release@v1 Create a policy-aware local release commit.

Configure release behavior through with:.

action.evin/[email protected] Skip the whole release when false.

Boolean or a template resolving to true or false; defaults to true. When false nothing is staged, committed, tagged, or pushed and committed is false.

action.evin/[email protected] Push the branch and tag after committing.

Opt-in. A rejected push keeps the local commit and tag so it can be retried.

action.evin/[email protected] Overwrite the remote branch and tag.

Uses git push --force, for bot-maintained branches rebuilt on every run.

action.evin/[email protected]_stale_tags Delete unreleased remote tags that match the tag format.

Requires tag and push.base. Tags whose commit is not reachable from <remote>/<base> are deleted; tags whose commit is missing locally are left alone.

action.evin/[email protected] Branch whose remote ref defines which tags are released.

Valid only with prune_stale_tags. Fetch the remote first so refs/remotes/<remote>/<base> exists.

Page source: reference/actions/40.git-release-action.5130.md