Skills Getting started Skills GitLab Hub

forge-release

Use when tagging a release commit, creating a GitLab or GitHub release with the changelog as its description, or checking that a tag's pipeline finished before announcing a version.

Synopsis

The YAML description states when to use this skill. disable-model-invocation is unset.

Source file: skills/forge-release/SKILL.md.

Front matter

name
forge-release
description
Use when tagging a release commit, creating a GitLab or GitHub release with the changelog as its description, or checking that a tag's pipeline finished before announcing a version.
disable-model-invocation
unset

Full contents

---
name: forge-release
description: Use when tagging a release commit, creating a GitLab or GitHub release with the changelog as its description, or checking that a tag's pipeline finished before announcing a version.
---

# Tag and forge release

The tag names one commit on the default branch. The forge release is that tag plus its
notes. The tag pipeline does the building and publishing; its result, not a local
build, says whether the version exists.

## Before the tag

All four hold, each checked with a command:

```console
$ git fetch origin && git merge-base --is-ancestor HEAD origin/main && echo "release commit is on main"
$ git tag --sort=-creatordate | head -3          # the pattern and tag type to copy
$ rg -n '^version' Cargo.toml cram.toml          # every version file shows the new version
$ rg -n '^## \[0.5.0\] - ' CHANGELOG.md          # the changelog section exists, dated
```

A protected default branch means the release commit lands through a merge request; tag
the merge commit after it lands, never the branch commit.

## Tag

Copy the previous tag's name pattern and tag type. A repository whose tags are annotated
gets an annotated tag with the message `<name> <version>`:

```console
$ git tag -a pot-v0.5.0 -m "pot 0.5.0" origin/main
$ git push origin pot-v0.5.0
```

Push the tag alone. A pushed tag stays where it is; a mistake is fixed by the next
patch version, unless the user asks for a retag.

## Watch the tag pipeline

```console
$ glab ci status --branch pot-v0.5.0 --live       # GitHub: gh run watch
```

Done when every job of that pipeline passed. Read a failure with `glab ci trace <job>`
and report it with the job name and the failing line.

## Release notes

The description is the changelog section for this version, copied verbatim. Extract the
section into a file and hand the file over:

```console
$ awk '/^## \[0.5.0\]/{f=1;next} /^## \[/{f=0} f' CHANGELOG.md > /tmp/notes-0.5.0.md
$ glab release create pot-v0.5.0 --name "pot 0.5.0" --notes-file /tmp/notes-0.5.0.md
$ gh release create pot-v0.5.0 --verify-tag --title "pot 0.5.0" --notes-file /tmp/notes-0.5.0.md
```

`glab release create` makes the tag from the default branch when it is missing. Push the
tag first so the release sits on the commit you chose. Use `--name`, not the bare tag,
so the title matches the previous releases (`glab release list`).

Done when the release page shows the notes:

```console
$ glab release view pot-v0.5.0
```