LinuxCommandLibrary

glab-release

Create GitLab project releases

TLDR

List releases in a Gitlab repository, limited to 30 items

$ glab release list
copy

Display information about a specific release
$ glab release view [tag]
copy

Create a new release
$ glab release create [tag]
copy

Delete a specific release
$ glab release delete [tag]
copy

Download assets from a specific release
$ glab release download [tag]
copy

Upload assets to a specific release
$ glab release upload [tag] [path/to/file1 path/to/file2 ...]
copy

SYNOPSIS

`glab release [flags]`

Common Subcommands:

Create a new release:
`glab release create [flags]`

List all releases:
`glab release list [flags]`

View a specific release:
`glab release view [flags]`

Upload assets to an existing release:
`glab release upload [flags]`

Delete a release:
`glab release delete [flags]`

PARAMETERS


    Specifies the action to perform on releases, such as 'create', 'list', 'view', 'delete', or 'upload'.


    Required for 'create', 'view', 'delete', and 'upload' subcommands. It specifies the Git tag associated with the release.

-D, --description
    (For 'create' subcommand) Sets the description for the new release.

-F, --notes-file
    (For 'create' subcommand) Reads release notes from the specified file. Markdown supported.

--name
    (For 'create' subcommand) Provides a user-friendly name for the release.

-r, --ref
    (For 'create' subcommand) Specifies the Git reference (commit SHA, branch, or another tag) from which the release is created.

-a, --asset
    (For 'create' or 'upload' subcommand) Path to a release asset file to be attached. Can be used multiple times for multiple assets.

--asset-url
    (For 'create' or 'upload' subcommand) Specifies a URL for an external release asset. Only used when a single asset is specified.

--host
    Overrides the default GitLab host (e.g., 'gitlab.com') for the operation.

--repo / or
    Specifies an alternative repository to operate on, if not the current directory's.

DESCRIPTION

The `glab release` command is a powerful subcommand of the official GitLab CLI (`glab`) designed to streamline the management of GitLab project releases. It provides a command-line interface to interact with the GitLab Releases API, enabling users to perform various operations directly from their terminal or within automated scripts.

With `glab release`, you can create new releases, associating them with specific Git tags and attaching release assets such as binaries or documentation. It also allows for viewing details of a particular release, listing all releases for a project, and deleting unwanted releases. Furthermore, it supports uploading additional assets to existing releases. This command significantly simplifies the release process, especially when integrated into CI/CD pipelines, by abstracting direct API calls and providing a user-friendly interface.

CAVEATS

Operating with `glab release` requires an authenticated `glab` session, typically established via `glab auth login`. The user must have sufficient permissions within the GitLab project (usually Developer role or higher) to create, update, or delete releases. All release operations are fundamentally tied to Git tags, meaning a corresponding Git tag must exist or be created for a release to be managed. Asset handling, especially with multiple files or specific types, requires careful attention to the command flags.

INTEGRATION WITH GITLAB CI/CD

`glab release` is frequently used within GitLab CI/CD pipelines to automate the release process. After building and testing artifacts, the CI/CD job can use `glab release create` to publish a new release, attach generated binaries as assets, and even automatically generate release notes from commit messages. This ensures consistent and automated release deployments.

KEY CONSIDERATIONS FOR ASSETS

When attaching assets using `-a, --asset`, `glab` automatically infers asset name, type, and URL. For more control, especially when uploading a single asset, flags like `--asset-name`, `--asset-type`, and `--asset-url` can be used to specify these details explicitly. For multiple assets, `-a` can be provided multiple times.

HISTORY

The `glab` CLI tool was developed by GitLab to provide a robust command-line interface for its platform. The `release` subcommand was introduced to offer direct terminal access to GitLab's powerful Releases API, which manages software releases and their associated assets. Its development mirrors the growing importance of structured release management and automation, particularly within CI/CD pipelines, allowing developers to manage releases efficiently without leaving the command line or relying solely on the web UI.

SEE ALSO

git(1), git-tag(1), glab(1)

Copied to clipboard