120

I had created a private repository which I then changed to public repository. However, I could not find any way to release. Is it possible to create releases in GitLab? If so, how are they done?

Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
Tom Kurushingal
  • 6,086
  • 20
  • 54
  • 86
  • 2
    Possible duplicate of [How to store releases/binaries in GitLab?](https://stackoverflow.com/questions/29013457/how-to-store-releases-binaries-in-gitlab) – Ciro Santilli OurBigBook.com Jun 01 '18 at 14:28
  • Note: with GitLab 13.10 (March 2021) you can create a release from an existing tag! See [my updated answer below](https://stackoverflow.com/a/29521646/6309). – VonC Mar 22 '21 at 20:31

5 Answers5

151

To create a release on the GitLab website:

  1. Go to your repository
  2. In the menu choose Repository > Tags
  3. Add a tag for the version of your app. For example, v1.3.1.
  4. Add a message (title) about the release. For example, Release 1.3.1.
  5. Add a note that describes the details of the release. (Not optional. Adding a note to a tag is what makes it a release.)
  6. Click Create tag.

enter image description here

The release will now show up under Project > Releases. Read more at the GitLab documentation. GitLab recommends that you use the Release API now, but their documentation is hard to follow. It would be the preferred method for automating everything with CI/CD, though.

Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
  • 54
    It seems that for a tag to show up under Releases, the tag *must* have some release notes. If that field is empty, it won't show up as a release. Had me scratching my head for ages. – developius Jun 10 '19 at 05:17
  • that's it ?? we dont have any other hurdles !! after creating tag the repository is realise right ? – hio Jan 13 '20 at 12:30
  • 3
    @ParthPitroda, Yes, tag + message + release notes = release – Suragch Jan 13 '20 at 14:09
64

If you are talking about GitHub-like release, where you associate one or several binaries to a tag, then no, GitLab doesn't include this feature yet.

You have a suggestion in progress, for which Pull Request are accepted.

Update Nov 2015: As I mentioned in "How to store releases/binaries in GitLab?", GitLab 8.2 supports releases.

With releases you can now add a Markdown-formatted message to any Git tag and attach any number of files to it.

Note: its release API does not support file attachment yet.

Keelan mentions in the comments that issue 31221 is tracking that request.


GitLab 11.7 (January 2019) adds the ability to create releases in GitLab and view them on a summary page.

Releases are a snapshot in time of the source, links, and other metadata or artifacts associated with a released version of your code, and allow for users of your project to easily discover the latest released version of your code.

https://about.gitlab.com/images/11_7/release-releases_page.png


GitLab 12.6 (Dec. 2019) adds "Automated Release Evidence collection to support audits"

GitLab Releases now have a new Evidence collection entry in which you can find a snapshot of the Release’s metadata in JSON format. This snapshot can be leveraged as a chain of custody to support review and compliance processes, such as audits.

See issue 26019 and documentation.

https://about.gitlab.com/images/12_6/release_evidence.png


GitLab 12.10 (April 2020) allows:

Compare Release Evidence over time

(for Premium+ edition only)


GitLab 13.2 (July 2020) adds:

Create releases from .gitlab-ci.yml

In 12.10, we introduced a way for you to automatically create release tags from the .gitlab-ci.yml file.
Now we’ve made it easier and more natural to use by exposing the release keyword as a step the GitLab Runner can parse. You no longer need to add a script to call the Release API to create a release.
Instead, you can simply add the correct parameters to your CI/CD file.

https://about.gitlab.com/images/13_2/release_yaml.png

See documentation and issue.


GitLab 13.5 (October 2020) now has:

Attach binary assets to Releases

If you aren’t currently using GitLab for your releases because you can’t attach binaries to releases, your workflow just got a lot simpler.

You now have the ability to attach binaries to a release tag from the gitlab.ci-yml. This extends support of Release Assets to include binaries, rather than just asset links or source code. This makes it even easier for your development teams to adopt GitLab and use it to automate your release process.

https://about.gitlab.com/images/13_5/release_assets.png -- Attach binary assets to Releases

See Documentation and Issue.


With GitLab 13.7 (December 2020):

Define your release description in an external file

If you create releases in your pipelines via your project’s .gitlab-ci.yml file, you’ve probably found it difficult to maintain each release’s description.

In GitLab 13.7, you can now define your release description in a source-controlled or auto-generated file and call it from .gitlab-ci.yml.
Doing so loads the file’s content into your release description as Markdown.

This makes releases easier for you to create, maintain, and use with version control and is especially useful if you want to auto-generate your changelogs.
Huge thanks to Nejc Habjan and Siemens for a great community contribution!

See Documentation and Issue.


See GitLab 13.10 (March 2021)

Create a release from an existing tag

Previously, creating a release was supported only for new tags. In GitLab 13.10, you can now create a release by selecting an existing tag, something that will give you more flexibility when planning releases.

https://about.gitlab.com/images/13_10/exiting_tags.png -- Create a release from an existing tag

See Documentation and Issue.


With GitLab 13.12 (May 2021)

release: keyword supports asset links

Since GitLab 13.2, you’ve been able to use the release: keyword, in conjunction with the release-cli, to create a release.

The release: keyword has now been extended to include support for asset links so that you can create releases and attach files to them in a single .gitlab-ci.yml release job.

https://about.gitlab.com/images/13_12/release-asset-links.png -- release: keyword supports asset links

See Documentation and Issue.


And GitLab 15.1 (June 2022) adds:

Create annotated Tags with the GraphQL Release API

Previously, you were only able to create lightweight tags when using the GraphQL API to create a release.

With this update, you can now add an optional tagMessage parameter to create an annotated tag when creating a release.
This enables you to include relevant information along with the new tag, so downstream users and applications can have additional context.

See Documentation and Issue.


And when creating a release with a GitLab CICD pipeline, GitLab 15.3 (August 2022) proposes:

Create annotated tags by using release:tag_message keyword

Create annotated tags by using release:tag_message keyword

You can now create an annotated tag when you create a release. In the .gitlab-ci.yaml file, use the release keyword to include an optional tag_message subkey and specify a message. This enables you to include relevant information along with the new tag, so downstream users and applications can have additional context.

See Documentation and Issue.

Or, still with GitLab 15.3 (August 2022):

Create annotated tags using the Release CLI

Previously, you were only able to create lightweight tags when using the GitLab Release CLI to create a release.

With this update, you can now add an optional tag-message parameter to create an annotated tag when creating a release.
This enables you to include relevant information along with the new tag so downstream users and application can have additional context.

See Documentation and Issue.

release-cli --server-url https://gitlab.com --job-token=SOME_JOB_TOKEN --project-id 12345 create help

With GitLab 15.5 (October 2022):

Create annotated tags in the Releases page

You can now create annotated tags and add them to your releases in the Releases page. You can use annotated tags to provide downstream users and applications with additional information about a release.

https://about.gitlab.com/images/15_5/release-create-annotated-tag.png -- Create annotated tags in the Releases page

See Documentation and Issue.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
19

Update Nov. 2015: GitLab 8.2 now supports releases.

With its API, you now can create and update a relase associated to a tag. For now, it is only the ability to add release notes (markdown text and attachments) to git tags (aka Releases).

GreenRobot
  • 191
  • 1
  • 2
16

Releases in a "modern" GitLab are more than just Git Tags. I've already written a thorough description on this exact topic.

In short creating of release consists of these steps:


1) Create a tag for your commit

git tag -a MY_TAG_NAME 30728cab


2) Push the tag to your remote repository

git push REMOTE_REPO_NAME REMOTE_BRANCH_NAME MY_TAG_NAME


3) Upload a file

curl --request POST --header "Private-Token: YOUR_PRIVATE_TOKEN" --form "file=@/PATH/TO/THE/FILE/file.txt" "https://MY_GITLAB_HOSTING.COM/api/v4/projects/MY_PROJECT_ID/uploads"


WARNING: There is no official way to delete the uploaded binary from the GitLab repository then - I recommend to save it to some other hosting and just save the link!


4) Create a release

curl --request POST --header 'Content-Type: application/json' --header "Private-Token: YOUR_PRIVATE_TOKEN" --data '{"name": "MY_RELEASE_NAME", "tag_name": "MY_TAG_NAME", "description": "Release with the binary LINK_TO_YOUR_BINARY"}' "https://MY_GITLAB_HOSTING.COM/api/v4/projects/MY_PROJECT_ID/releases"


Finally I strongly recommend to have a look primarily at my older, linked answer, as many things are explained there and helpful Bash scripts are attached, too!

Eenoku
  • 2,741
  • 4
  • 32
  • 64
5

Use gitlab tags.

create a tag w/ name of tag & commit note git tag -a v1.05 -m "1st stabe release

push changes git push origin --tag

I haven't been able to figure out how to use the markdown release notes on gitlab yet which allows you to add links. You might have to do it manually or use their rest api.

Direct source: https://docs.gitlab.com/ee/university/training/topics/tags.html

lastlink
  • 1,505
  • 2
  • 19
  • 29