glab release create: Publish GitLab Releases in CI
glab release create publishes a release for a tag and can attach asset files and links non-interactively.
For automated release pipelines on GitLab, glab release create turns a tag into a published release with notes and downloadable assets in one call.
What it does
glab release create creates a GitLab release tied to a Git tag, with release notes from a flag or file, and optionally uploads asset files or registers external asset links. If the tag does not exist it can be created with --ref.
Common usage
# release from an existing tag with notes and a binary asset
glab release create v1.2.0 ./dist/app-linux \
--notes "Automated release"
# notes from a file, create the tag from a ref
glab release create v1.2.0 --notes-file CHANGELOG.md --ref "$CI_COMMIT_SHA"Options
| Flag | What it does |
|---|---|
| <tag> [files...] | Tag name followed by asset files to upload |
| --notes <text> | Release notes inline |
| --notes-file <f> | Read release notes from a file |
| --ref <ref> | Create the tag at this ref if it does not exist |
| --assets-links <json> | Register external asset links as JSON |
| --milestone <m> | Associate one or more milestones |
In CI
Pass notes via --notes or --notes-file so no editor opens. Use CI_COMMIT_TAG as the tag in tag pipelines. The token needs api scope; CI_JOB_TOKEN can create releases in the same project but not upload to arbitrary others.
Common errors in CI
"authentication required" means GITLAB_TOKEN is unset or invalid. "Release already exists" (409) means a release for that tag was already published; delete it or use glab release update. "404 Not Found" on --ref means the ref does not exist. "invalid tag name" means CI_COMMIT_TAG was empty because the job did not run on a tag.
Using this in CI
CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.
- uses: actions/checkout@v4
with:
fetch-depth: 0 # history, tags, and git describe all need this
- run: |
git rev-parse --is-shallow-repository # expect false
git rev-parse --abbrev-ref HEAD # prints HEAD when detached