summaryrefslogtreecommitdiff
path: root/doc/user/project/releases/release_cli.md
blob: 90363fca8b012214169f7d85eb8123403491f377 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
stage: Release
group: Release
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---


# GitLab Release CLI tool

The [GitLab Release CLI (`release-cli`)](https://gitlab.com/gitlab-org/release-cli) tool
is a command-line tool for managing releases from the command line or from a CI/CD pipeline.
You can use the release CLI to create, update, modify, and delete releases.

When you [use a CI/CD job to create a release](index.md#creating-a-release-by-using-a-cicd-job),
the `release` keyword entries are transformed into Bash commands and sent to the Docker
container containing the `release-cli` tool. The tool then creates the release.

You can also call the `release-cli` tool directly from a [`script`](../../../ci/yaml/index.md#script).
For example:

```shell
release-cli create --name "Release $CI_COMMIT_SHA" --description \
  "Created using the release-cli $EXTRA_DESCRIPTION" \
  --tag-name "v${MAJOR}.${MINOR}.${REVISION}" --ref "$CI_COMMIT_SHA" \
  --released-at "2020-07-15T08:00:00Z" --milestone "m1" --milestone "m2" --milestone "m3" \
  --assets-link "{\"name\":\"asset1\",\"url\":\"https://example.com/assets/1\",\"link_type\":\"other\"}
```

## Install the `release-cli` for the Shell executor **(FREE)**

> - [Introduced](https://gitlab.com/gitlab-org/release-cli/-/issues/21) in GitLab 13.8.
> - [Changed](https://gitlab.com/gitlab-org/release-cli/-/merge_requests/108) in GitLab 14.2, the `release-cli` binaries are also [available in the Package Registry](https://gitlab.com/gitlab-org/release-cli/-/packages).

When you use a runner with the Shell executor, you can download and install
the `release-cli` manually for your [supported OS and architecture](https://release-cli-downloads.s3.amazonaws.com/latest/index.html).
Once installed, [the `release` keyword](../../../ci/yaml/index.md#release) is available to use in your CI/CD jobs.

### Install on Unix/Linux

1. Download the binary for your system from S3, in the following example for amd64 systems:

   ```shell
   curl --location --output /usr/local/bin/release-cli "https://release-cli-downloads.s3.amazonaws.com/latest/release-cli-linux-amd64"
   ```

   Or from the GitLab Package Registry:

   ```shell
   curl --location --output /usr/local/bin/release-cli "https://gitlab.com/api/v4/projects/gitlab-org%2Frelease-cli/packages/generic/release-cli/latest/release-cli-linux-amd64"
   ```

1. Give it permissions to execute:

   ```shell
   sudo chmod +x /usr/local/bin/release-cli
   ```

1. Verify `release-cli` is available:

   ```shell
   $ release-cli -v

   release-cli version 0.6.0
   ```

### Install on Windows PowerShell

1. Create a folder somewhere in your system, for example `C:\GitLab\Release-CLI\bin`

   ```shell
   New-Item -Path 'C:\GitLab\Release-CLI\bin' -ItemType Directory
   ```

1. Download the executable file:

   ```shell
   PS C:\> Invoke-WebRequest -Uri "https://release-cli-downloads.s3.amazonaws.com/latest/release-cli-windows-amd64.exe" -OutFile "C:\GitLab\Release-CLI\bin\release-cli.exe"

       Directory: C:\GitLab\Release-CLI
   Mode                LastWriteTime         Length Name
   ----                -------------         ------ ----
   d-----        3/16/2021   4:17 AM                bin
   ```

1. Add the directory to your `$env:PATH`:

   ```shell
   $env:PATH += ";C:\GitLab\Release-CLI\bin"
   ```

1. Verify `release-cli` is available:

   ```shell
   PS C:\> release-cli -v

   release-cli version 0.6.0
   ```