APIをリリース
- リリース証明はGitLab 12.5で導入されました。
description_htmlパフォーマンス上の理由から、GitLab 13.12でオプトインフィールドになりました。必要な場合はinclude_html_descriptionクエリ文字列パラメータを渡してください。- GitLab 14.1で、作成、更新、削除アクションの権限モデルが修正されました。詳しくはリリース権限をご覧ください。
GitLabReleaseエントリを操作するには、このAPIを使用してください。リリースアセットとしてのリンクの操作については、Release Links APIを参照してください。
認証
リリースAPIでは、以下のいずれかの認証が可能です:
- 
PRIVATE-TOKENヘッダを使用したパーソナルアクセストークン。
- 
GitLab CI/CD ジョブトークン $CI_JOB_TOKENJOB-TOKENヘッダを使用します。
リリース一覧
released_at でソートされたリリースのページ付きリストを返します。
GET /projects/:id/releases
| 属性 | 種類 | 必須 | 説明 | 
|---|---|---|---|
| id | 整数/文字列 | yes | プロジェクトのIDまたはURLエンコードされたパス。 | 
| order_by | 文字列です。 | いいえ | 順序として使用するフィールド。 released_at(デフォルト)またはcreated_at。 | 
| sort | 文字列です。 | いいえ | 順序の方向。降順の場合は desc(デフォルト)、昇順の場合はascのいずれかを指定します。 | 
| include_html_description | boolean | いいえ | trueの場合、レスポンスにはリリースの説明を HTML でレンダリングした Markdown が含まれます。 | 
成功した場合は、200 OK と以下のレスポンス属性を返します:
| 属性 | 種類 | 説明 | 
|---|---|---|
| []._links | オブジェクトを返します。 | リリースのリンク。 | 
| []._links.closed_issues_url | 文字列です。 | リリースのクローズされたイシューの HTTP URL。 | 
| []._links.closed_merge_requests_url | 文字列です。 | リリースのクローズされたマージリクエストの HTTP URL。 | 
| []._links.edit_url | 文字列です。 | リリースの編集ページのHTTP URL。 | 
| []._links.merged_merge_requests_url | 文字列です。 | リリースのマージリクエストの HTTP URL。 | 
| []._links.opened_issues_url | 文字列です。 | リリースのオープンイシューの HTTP URL。 | 
| []._links.opened_merge_requests_url | 文字列です。 | リリースのオープンマージリクエストの HTTP URL。 | 
| []._links.self | 文字列です。 | リリースの HTTP URL。 | 
リクエストの例
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/24/releases"
応答例
[
   {
      "tag_name":"v0.2",
      "description":"## CHANGELOG\r\n\r\n- Escape label and milestone titles to prevent XSS in GLFM autocomplete. !2740\r\n- Prevent private snippets from being embeddable.\r\n- Add subresources removal to member destroy service.",
      "name":"Awesome app v0.2 beta",
      "created_at":"2019-01-03T01:56:19.539Z",
      "released_at":"2019-01-03T01:56:19.539Z",
      "author":{
         "id":1,
         "name":"Administrator",
         "username":"root",
         "state":"active",
         "avatar_url":"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
         "web_url":"https://gitlab.example.com/root"
      },
      "commit":{
         "id":"079e90101242458910cccd35eab0e211dfc359c0",
         "short_id":"079e9010",
         "title":"Update README.md",
         "created_at":"2019-01-03T01:55:38.000Z",
         "parent_ids":[
            "f8d3d94cbd347e924aa7b715845e439d00e80ca4"
         ],
         "message":"Update README.md",
         "author_name":"Administrator",
         "author_email":"admin@example.com",
         "authored_date":"2019-01-03T01:55:38.000Z",
         "committer_name":"Administrator",
         "committer_email":"admin@example.com",
         "committed_date":"2019-01-03T01:55:38.000Z"
      },
      "milestones": [
         {
            "id":51,
            "iid":1,
            "project_id":24,
            "title":"v1.0-rc",
            "description":"Voluptate fugiat possimus quis quod aliquam expedita.",
            "state":"closed",
            "created_at":"2019-07-12T19:45:44.256Z",
            "updated_at":"2019-07-12T19:45:44.256Z",
            "due_date":"2019-08-16",
            "start_date":"2019-07-30",
            "web_url":"https://gitlab.example.com/root/awesome-app/-/milestones/1",
            "issue_stats": {
               "total": 98,
               "closed": 76
            }
         },
         {
            "id":52,
            "iid":2,
            "project_id":24,
            "title":"v1.0",
            "description":"Voluptate fugiat possimus quis quod aliquam expedita.",
            "state":"closed",
            "created_at":"2019-07-16T14:00:12.256Z",
            "updated_at":"2019-07-16T14:00:12.256Z",
            "due_date":"2019-08-16",
            "start_date":"2019-07-30",
            "web_url":"https://gitlab.example.com/root/awesome-app/-/milestones/2",
            "issue_stats": {
               "total": 24,
               "closed": 21
            }
         }
      ],
      "commit_path":"/root/awesome-app/commit/588440f66559714280628a4f9799f0c4eb880a4a",
      "tag_path":"/root/awesome-app/-/tags/v0.11.1",
      "assets":{
         "count":6,
         "sources":[
            {
               "format":"zip",
               "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.2/awesome-app-v0.2.zip"
            },
            {
               "format":"tar.gz",
               "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.2/awesome-app-v0.2.tar.gz"
            },
            {
               "format":"tar.bz2",
               "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.2/awesome-app-v0.2.tar.bz2"
            },
            {
               "format":"tar",
               "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.2/awesome-app-v0.2.tar"
            }
         ],
         "links":[
            {
               "id":2,
               "name":"awesome-v0.2.msi",
               "url":"http://192.168.10.15:3000/msi",
               "link_type":"other"
            },
            {
               "id":1,
               "name":"awesome-v0.2.dmg",
               "url":"http://192.168.10.15:3000",
               "link_type":"other"
            }
         ],
         "evidence_file_path":"https://gitlab.example.com/root/awesome-app/-/releases/v0.2/evidence.json"
      },
      "evidences":[
        {
          "sha": "760d6cdfb0879c3ffedec13af470e0f71cf52c6cde4d",
          "filepath": "https://gitlab.example.com/root/awesome-app/-/releases/v0.2/evidence.json",
          "collected_at": "2019-01-03T01:56:19.539Z"
        }
     ]
   },
   {
      "tag_name":"v0.1",
      "description":"## CHANGELOG\r\n\r\n-Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516",
      "name":"Awesome app v0.1 alpha",
      "created_at":"2019-01-03T01:55:18.203Z",
      "released_at":"2019-01-03T01:55:18.203Z",
      "author":{
         "id":1,
         "name":"Administrator",
         "username":"root",
         "state":"active",
         "avatar_url":"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
         "web_url":"https://gitlab.example.com/root"
      },
      "commit":{
         "id":"f8d3d94cbd347e924aa7b715845e439d00e80ca4",
         "short_id":"f8d3d94c",
         "title":"Initial commit",
         "created_at":"2019-01-03T01:53:28.000Z",
         "parent_ids":[
         ],
         "message":"Initial commit",
         "author_name":"Administrator",
         "author_email":"admin@example.com",
         "authored_date":"2019-01-03T01:53:28.000Z",
         "committer_name":"Administrator",
         "committer_email":"admin@example.com",
         "committed_date":"2019-01-03T01:53:28.000Z"
      },
      "assets":{
         "count":4,
         "sources":[
            {
               "format":"zip",
               "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.zip"
            },
            {
               "format":"tar.gz",
               "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.gz"
            },
            {
               "format":"tar.bz2",
               "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.bz2"
            },
            {
               "format":"tar",
               "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar"
            }
         ],
         "links":[
         ],
         "evidence_file_path":"https://gitlab.example.com/root/awesome-app/-/releases/v0.1/evidence.json"
      },
      "evidences":[
        {
          "sha": "c3ffedec13af470e760d6cdfb08790f71cf52c6cde4d",
          "filepath": "https://gitlab.example.com/root/awesome-app/-/releases/v0.1/evidence.json",
          "collected_at": "2019-01-03T01:55:18.203Z"
        }
      ],
      "_links": {
         "closed_issues_url": "https://gitlab.example.com/root/awesome-app/-/issues?release_tag=v0.1&scope=all&state=closed",
         "closed_merge_requests_url": "https://gitlab.example.com/root/awesome-app/-/merge_requests?release_tag=v0.1&scope=all&state=closed",
         "edit_url": "https://gitlab.example.com/root/awesome-app/-/releases/v0.1/edit",
         "merged_merge_requests_url": "https://gitlab.example.com/root/awesome-app/-/merge_requests?release_tag=v0.1&scope=all&state=merged",
         "opened_issues_url": "https://gitlab.example.com/root/awesome-app/-/issues?release_tag=v0.1&scope=all&state=opened",
         "opened_merge_requests_url": "https://gitlab.example.com/root/awesome-app/-/merge_requests?release_tag=v0.1&scope=all&state=opened",
         "self": "https://gitlab.example.com/root/awesome-app/-/releases/v0.1"
      }
   }
]
タグ名によるリリースの取得
指定したタグのリリースを取得します。
GET /projects/:id/releases/:tag_name
| 属性 | 種類 | 必須 | 説明 | 
|---|---|---|---|
| id | 整数/文字列 | yes | プロジェクトのIDまたはURLエンコードされたパス。 | 
| tag_name | 文字列です。 | yes | リリースが関連付けられている Git タグ。 | 
| include_html_description | boolean | いいえ | trueの場合、レスポンスにはリリースの説明を HTML でレンダリングした Markdown が含まれます。 | 
成功した場合は、200 OK と以下のレスポンス属性を返します:
| 属性 | 種類 | 説明 | 
|---|---|---|
| []._links | オブジェクトを返します。 | リリースのリンク。 | 
| []._links.closed_issues_url | 文字列です。 | リリースのクローズされたイシューの HTTP URL。 | 
| []._links.closed_merge_requests_url | 文字列です。 | リリースのクローズされたマージリクエストの HTTP URL。 | 
| []._links.edit_url | 文字列です。 | リリースの編集ページのHTTP URL。 | 
| []._links.merged_merge_requests_url | 文字列です。 | リリースのマージリクエストの HTTP URL。 | 
| []._links.opened_issues_url | 文字列です。 | リリースのオープンイシューの HTTP URL。 | 
| []._links.opened_merge_requests_url | 文字列です。 | リリースのオープンマージリクエストの HTTP URL。 | 
| []._links.self | 文字列です。 | リリースの HTTP URL。 | 
リクエストの例
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1"
応答例
{
   "tag_name":"v0.1",
   "description":"## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516",
   "name":"Awesome app v0.1 alpha",
   "created_at":"2019-01-03T01:55:18.203Z",
   "released_at":"2019-01-03T01:55:18.203Z",
   "author":{
      "id":1,
      "name":"Administrator",
      "username":"root",
      "state":"active",
      "avatar_url":"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
      "web_url":"https://gitlab.example.com/root"
   },
   "commit":{
      "id":"f8d3d94cbd347e924aa7b715845e439d00e80ca4",
      "short_id":"f8d3d94c",
      "title":"Initial commit",
      "created_at":"2019-01-03T01:53:28.000Z",
      "parent_ids":[
      ],
      "message":"Initial commit",
      "author_name":"Administrator",
      "author_email":"admin@example.com",
      "authored_date":"2019-01-03T01:53:28.000Z",
      "committer_name":"Administrator",
      "committer_email":"admin@example.com",
      "committed_date":"2019-01-03T01:53:28.000Z"
   },
   "milestones": [
       {
         "id":51,
         "iid":1,
         "project_id":24,
         "title":"v1.0-rc",
         "description":"Voluptate fugiat possimus quis quod aliquam expedita.",
         "state":"closed",
         "created_at":"2019-07-12T19:45:44.256Z",
         "updated_at":"2019-07-12T19:45:44.256Z",
         "due_date":"2019-08-16",
         "start_date":"2019-07-30",
         "web_url":"https://gitlab.example.com/root/awesome-app/-/milestones/1",
         "issue_stats": {
            "total": 98,
            "closed": 76
         }
       },
       {
         "id":52,
         "iid":2,
         "project_id":24,
         "title":"v1.0",
         "description":"Voluptate fugiat possimus quis quod aliquam expedita.",
         "state":"closed",
         "created_at":"2019-07-16T14:00:12.256Z",
         "updated_at":"2019-07-16T14:00:12.256Z",
         "due_date":"2019-08-16",
         "start_date":"2019-07-30",
         "web_url":"https://gitlab.example.com/root/awesome-app/-/milestones/2",
         "issue_stats": {
            "total": 24,
            "closed": 21
         }
       }
   ],
   "commit_path":"/root/awesome-app/commit/588440f66559714280628a4f9799f0c4eb880a4a",
   "tag_path":"/root/awesome-app/-/tags/v0.11.1",
   "assets":{
      "count":5,
      "sources":[
         {
            "format":"zip",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.zip"
         },
         {
            "format":"tar.gz",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.gz"
         },
         {
            "format":"tar.bz2",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.bz2"
         },
         {
            "format":"tar",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar"
         }
      ],
      "links":[
         {
            "id":3,
            "name":"hoge",
            "url":"https://gitlab.example.com/root/awesome-app/-/tags/v0.11.1/binaries/linux-amd64",
            "link_type":"other"
         }
      ]
   },
   "evidences":[
     {
       "sha": "760d6cdfb0879c3ffedec13af470e0f71cf52c6cde4d",
       "filepath": "https://gitlab.example.com/root/awesome-app/-/releases/v0.1/evidence.json",
       "collected_at": "2019-07-16T14:00:12.256Z"
     },
   "_links": {
      "closed_issues_url": "https://gitlab.example.com/root/awesome-app/-/issues?release_tag=v0.1&scope=all&state=closed",
      "closed_merge_requests_url": "https://gitlab.example.com/root/awesome-app/-/merge_requests?release_tag=v0.1&scope=all&state=closed",
      "edit_url": "https://gitlab.example.com/root/awesome-app/-/releases/v0.1/edit",
      "merged_merge_requests_url": "https://gitlab.example.com/root/awesome-app/-/merge_requests?release_tag=v0.1&scope=all&state=merged",
      "opened_issues_url": "https://gitlab.example.com/root/awesome-app/-/issues?release_tag=v0.1&scope=all&state=opened",
      "opened_merge_requests_url": "https://gitlab.example.com/root/awesome-app/-/merge_requests?release_tag=v0.1&scope=all&state=opened",
      "self": "https://gitlab.example.com/root/awesome-app/-/releases/v0.1"
    }
  ]
}
リリース資産のダウンロード
GitLab 15.4で導入されました。
リリースアセットファイルをダウンロードするには、以下のフォーマットでリクエストしてください:
GET /projects/:id/releases/:tag_name/downloads/:direct_asset_path
| 属性 | 種類 | 必須 | 説明 | 
|---|---|---|---|
| id | 整数/文字列 | yes | プロジェクトのIDまたはURLエンコードされたパス。 | 
| tag_name | 文字列です。 | yes | リリースが関連付けられている Git タグ。 | 
| filepath | 文字列です。 | yes | 非推奨:代わりに direct_asset_pathを使ってください。 | 
| direct_asset_path | 文字列です。 | yes | リンクの作成または更新時に指定したリリースアセットファイルへのパス。 | 
リクエストの例
curl --location --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/downloads/bin/asset.exe"
最新リリースの取得
GitLab 15.4で導入されました。
最新のリリース情報は永続的な API URL からアクセスできます。
URLの形式は以下の通りです:
GET /projects/:id/releases/permalink/latest
リリースタグを必要とするその他のGET APIを呼び出すには、permalink/latest APIパスにサフィックスを追加します。
例えば、最新リリースのエビデンスを取得するには、次のようにします:
GET /projects/:id/releases/permalink/latest/evidence
別の例として、最新リリースのアセットをダウンロードすることができます:
GET /projects/:id/releases/permalink/latest/downloads/bin/asset.exe
環境設定の並べ替え
デフォルトでは、GitLab はreleased_at を使ってリリースを取得します。クエリパラメータ?order_by=released_at の使用はオプションで、?order_by=semver のサポートはissue 352945 で追跡されています。
リリースの作成
リリースを作成します。リリースを作成するには、プロジェクトへの開発者レベルのアクセスが必要です。
POST /projects/:id/releases
| 属性 | 種類 | 必須 | 説明 | 
|---|---|---|---|
| id | 整数/文字列 | yes | プロジェクトのIDまたはURLエンコードされたパス。 | 
| name | 文字列です。 | いいえ | リリース名。 | 
| tag_name | 文字列です。 | yes | リリースが作成されるタグ。 | 
| tag_message | 文字列です。 | いいえ | 新しい注釈付きタグを作成する際に使用するメッセージ。 | 
| description | 文字列です。 | いいえ | リリースの説明。Markdownを使用できます。 | 
| ref | 文字列です。 | はい、 tag_nameが存在しない場合。 | tag_nameで指定されたタグが存在しない場合、リリースはrefから作成され、tag_nameでタグ付けされます。これはコミット SHA、別のタグ名、ブランチ名のいずれかです。 | 
| milestones | 文字列の配列 | いいえ | リリースが関連付けられている各マイルストーンのタイトルです。GitLabプレミアムのお客様はグループのマイルストーンを指定できます。 | 
| assets:links | ハッシュの配列 | いいえ | アセットリンクの配列。 | 
| assets:links:name | 文字列です。 | が必要です: assets:links | リンクの名前。リンク名はリリース内で一意でなければなりません。 | 
| assets:links:url | 文字列です。 | が必要です: assets:links | リンクのURL。リンクURLはリリース内で一意でなければなりません。 | 
| assets:links:filepath | 文字列です。 | いいえ | 非推奨:代わりに direct_asset_pathを使ってください。 | 
| assets:links:direct_asset_path | 文字列です。 | いいえ | アセットへの直接リンクのためのオプションのパス。 | 
| assets:links:link_type | 文字列です。 | いいえ | リンクのタイプ: otherrunbook,image,package.デフォルトはotherです。 | 
| released_at | datetime | いいえ | リリースの日時。デフォルトは現在の時刻です。ISO 8601形式( 2019-03-15T08:00:00Z)で指定します。今後のリリースまたは過去のリリースを作成する場合のみ、このフィールドを入力してください。 | 
リクエストの例
curl --header 'Content-Type: application/json' --header "PRIVATE-TOKEN: <your_access_token>" \
     --data '{ "name": "New release", "tag_name": "v0.3", "description": "Super nice release", "milestones": ["v1.0", "v1.0-rc"], "assets": { "links": [{ "name": "hoge", "url": "https://google.com", "direct_asset_path": "/binaries/linux-amd64", "link_type":"other" }] } }' \
     --request POST "https://gitlab.example.com/api/v4/projects/24/releases"
応答例
{
   "tag_name":"v0.3",
   "description":"Super nice release",
   "name":"New release",
   "created_at":"2019-01-03T02:22:45.118Z",
   "released_at":"2019-01-03T02:22:45.118Z",
   "author":{
      "id":1,
      "name":"Administrator",
      "username":"root",
      "state":"active",
      "avatar_url":"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
      "web_url":"https://gitlab.example.com/root"
   },
   "commit":{
      "id":"079e90101242458910cccd35eab0e211dfc359c0",
      "short_id":"079e9010",
      "title":"Update README.md",
      "created_at":"2019-01-03T01:55:38.000Z",
      "parent_ids":[
         "f8d3d94cbd347e924aa7b715845e439d00e80ca4"
      ],
      "message":"Update README.md",
      "author_name":"Administrator",
      "author_email":"admin@example.com",
      "authored_date":"2019-01-03T01:55:38.000Z",
      "committer_name":"Administrator",
      "committer_email":"admin@example.com",
      "committed_date":"2019-01-03T01:55:38.000Z"
   },
   "milestones": [
       {
         "id":51,
         "iid":1,
         "project_id":24,
         "title":"v1.0-rc",
         "description":"Voluptate fugiat possimus quis quod aliquam expedita.",
         "state":"closed",
         "created_at":"2019-07-12T19:45:44.256Z",
         "updated_at":"2019-07-12T19:45:44.256Z",
         "due_date":"2019-08-16",
         "start_date":"2019-07-30",
         "web_url":"https://gitlab.example.com/root/awesome-app/-/milestones/1",
         "issue_stats": {
            "total": 99,
            "closed": 76
         }
       },
       {
         "id":52,
         "iid":2,
         "project_id":24,
         "title":"v1.0",
         "description":"Voluptate fugiat possimus quis quod aliquam expedita.",
         "state":"closed",
         "created_at":"2019-07-16T14:00:12.256Z",
         "updated_at":"2019-07-16T14:00:12.256Z",
         "due_date":"2019-08-16",
         "start_date":"2019-07-30",
         "web_url":"https://gitlab.example.com/root/awesome-app/-/milestones/2",
         "issue_stats": {
            "total": 24,
            "closed": 21
         }
       }
   ],
   "commit_path":"/root/awesome-app/commit/588440f66559714280628a4f9799f0c4eb880a4a",
   "tag_path":"/root/awesome-app/-/tags/v0.11.1",
   "evidence_sha":"760d6cdfb0879c3ffedec13af470e0f71cf52c6cde4d",
   "assets":{
      "count":5,
      "sources":[
         {
            "format":"zip",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.3/awesome-app-v0.3.zip"
         },
         {
            "format":"tar.gz",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.3/awesome-app-v0.3.tar.gz"
         },
         {
            "format":"tar.bz2",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.3/awesome-app-v0.3.tar.bz2"
         },
         {
            "format":"tar",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.3/awesome-app-v0.3.tar"
         }
      ],
      "links":[
         {
            "id":3,
            "name":"hoge",
            "url":"https://gitlab.example.com/root/awesome-app/-/tags/v0.11.1/binaries/linux-amd64",
            "link_type":"other"
         }
      ],
      "evidence_file_path":"https://gitlab.example.com/root/awesome-app/-/releases/v0.3/evidence.json"
   }
}
グループのマイルストーン
GitLab 13.5 で導入されました。
プロジェクトに関連するグループのマイルストーンは、Create a releaseおよびUpdate a releaseAPI 呼び出しのmilestones 配列で指定することができます。指定できるのはプロジェクトのグループに関連するマイルストーンだけで、先祖グループのマイルストーンを追加するとエラーになります。
リリースの証拠の収集
既存のリリースのエビデンスを作成します。
POST /projects/:id/releases/:tag_name/evidence
| 属性 | 種類 | 必須 | 説明 | 
|---|---|---|---|
| id | 整数/文字列 | yes | プロジェクトのIDまたはURLエンコードされたパス。 | 
| tag_name | 文字列です。 | yes | リリースが関連付けられている Git タグ。 | 
リクエストの例
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/evidence"
応答例
200
リリースの更新
GitLab 14.5で
JOB-TOKEN。
リリースを更新します。リリースを更新するには、開発者レベルのプロジェクトへのアクセスが必要です。
PUT /projects/:id/releases/:tag_name
| 属性 | 種類 | 必須 | 説明 | 
|---|---|---|---|
| id | 整数/文字列 | yes | プロジェクトのIDまたはURLエンコードされたパス。 | 
| tag_name | 文字列です。 | yes | リリースが関連付けられている Git タグ。 | 
| name | 文字列です。 | いいえ | リリース名。 | 
| description | 文字列です。 | いいえ | リリースの説明。Markdownを使用できます。 | 
| milestones | 文字列の配列 | いいえ | リリースに関連付ける各マイルストーンのタイトル。GitLab Premiumをご利用のお客様は、グループのマイルストーンを指定することができます。リリースからすべてのマイルストーンを削除するには、 []を指定します。 | 
| released_at | datetime | いいえ | リリースの準備ができた/できた日付。ISO 8601 フォーマット ( 2019-03-15T08:00:00Z) で指定します。 | 
リクエストの例
curl --header 'Content-Type: application/json' --request PUT --data '{"name": "new name", "milestones": ["v1.2"]}' \
     --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1"
応答例
{
   "tag_name":"v0.1",
   "description":"## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516",
   "name":"new name",
   "created_at":"2019-01-03T01:55:18.203Z",
   "released_at":"2019-01-03T01:55:18.203Z",
   "author":{
      "id":1,
      "name":"Administrator",
      "username":"root",
      "state":"active",
      "avatar_url":"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
      "web_url":"https://gitlab.example.com/root"
   },
   "commit":{
      "id":"f8d3d94cbd347e924aa7b715845e439d00e80ca4",
      "short_id":"f8d3d94c",
      "title":"Initial commit",
      "created_at":"2019-01-03T01:53:28.000Z",
      "parent_ids":[
      ],
      "message":"Initial commit",
      "author_name":"Administrator",
      "author_email":"admin@example.com",
      "authored_date":"2019-01-03T01:53:28.000Z",
      "committer_name":"Administrator",
      "committer_email":"admin@example.com",
      "committed_date":"2019-01-03T01:53:28.000Z"
   },
   "milestones": [
      {
         "id":53,
         "iid":3,
         "project_id":24,
         "title":"v1.2",
         "description":"Voluptate fugiat possimus quis quod aliquam expedita.",
         "state":"active",
         "created_at":"2019-09-01T13:00:00.256Z",
         "updated_at":"2019-09-01T13:00:00.256Z",
         "due_date":"2019-09-20",
         "start_date":"2019-09-05",
         "web_url":"https://gitlab.example.com/root/awesome-app/-/milestones/3",
         "issue_stats": {
            "opened": 11,
            "closed": 78
         }
      }
   ],
   "commit_path":"/root/awesome-app/commit/588440f66559714280628a4f9799f0c4eb880a4a",
   "tag_path":"/root/awesome-app/-/tags/v0.11.1",
   "evidence_sha":"760d6cdfb0879c3ffedec13af470e0f71cf52c6cde4d",
   "assets":{
      "count":4,
      "sources":[
         {
            "format":"zip",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.zip"
         },
         {
            "format":"tar.gz",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.gz"
         },
         {
            "format":"tar.bz2",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.bz2"
         },
         {
            "format":"tar",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar"
         }
      ],
      "links":[
      ],
      "evidence_file_path":"https://gitlab.example.com/root/awesome-app/-/releases/v0.1/evidence.json"
   }
}
リリースの削除
GitLab 14.5で
JOB-TOKEN。
リリースを削除します。リリースを削除しても、関連するタグは削除されません。リリースを削除するには、プロジェクトへのメンテナー・レベルのアクセスが必要です。
DELETE /projects/:id/releases/:tag_name
| 属性 | 種類 | 必須 | 説明 | 
|---|---|---|---|
| id | 整数/文字列 | yes | プロジェクトのIDまたはURLエンコードされたパス。 | 
| tag_name | 文字列です。 | yes | リリースが関連付けられている Git タグ。 | 
リクエストの例
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1"
応答例
{
   "tag_name":"v0.1",
   "description":"## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516",
   "name":"new name",
   "created_at":"2019-01-03T01:55:18.203Z",
   "released_at":"2019-01-03T01:55:18.203Z",
   "author":{
      "id":1,
      "name":"Administrator",
      "username":"root",
      "state":"active",
      "avatar_url":"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
      "web_url":"https://gitlab.example.com/root"
   },
   "commit":{
      "id":"f8d3d94cbd347e924aa7b715845e439d00e80ca4",
      "short_id":"f8d3d94c",
      "title":"Initial commit",
      "created_at":"2019-01-03T01:53:28.000Z",
      "parent_ids":[
      ],
      "message":"Initial commit",
      "author_name":"Administrator",
      "author_email":"admin@example.com",
      "authored_date":"2019-01-03T01:53:28.000Z",
      "committer_name":"Administrator",
      "committer_email":"admin@example.com",
      "committed_date":"2019-01-03T01:53:28.000Z"
   },
   "commit_path":"/root/awesome-app/commit/588440f66559714280628a4f9799f0c4eb880a4a",
   "tag_path":"/root/awesome-app/-/tags/v0.11.1",
   "evidence_sha":"760d6cdfb0879c3ffedec13af470e0f71cf52c6cde4d",
   "assets":{
      "count":4,
      "sources":[
         {
            "format":"zip",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.zip"
         },
         {
            "format":"tar.gz",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.gz"
         },
         {
            "format":"tar.bz2",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar.bz2"
         },
         {
            "format":"tar",
            "url":"https://gitlab.example.com/root/awesome-app/-/archive/v0.1/awesome-app-v0.1.tar"
         }
      ],
      "links":[
      ],
      "evidence_file_path":"https://gitlab.example.com/root/awesome-app/-/releases/v0.1/evidence.json"
   }
}
今後のリリース
GitLab 12.1 で導入されました。
released_at 属性が未来の日付に設定されたリリースは、UI でUpcoming Releaseと表示されます。
さらに、API からリリースがリクエストされた場合、release_at 属性が将来の日付に設定されている各リリースについて、レスポンスの一部として追加の属性upcoming_release (true に設定) が返されます。
過去のリリース
GitLab 15.2 で導入されました。
released_at 属性に過去の日付が設定されたリリースは、UI で歴史的リリースと表示されます。
さらに、API からリリースがリクエストされた場合、release_at 属性が過去の日付に設定された各リリースについて、追加の属性historical_release (true に設定) がレスポンスの一部として返されます。
