# Releases

如果使用 project_full_path,确保 project_full_path 编码过,例子:/api/v3/projects/tencent/code--> /api/v3/projects/tencent%2Fcode (/ 编码 %2F)

Release 和 Tag 的区别详见:版本发布(releases)与基线(tag)的区别

注:以下接口除删除接口外,既适用于release,也适用于tag

# 获取 releases 列表

返回项目版本库 releases 列表

GET /api/v3/projects/:id/releases

参数:

参数 类型 描述
id integer 或 string 项目 ID 或 项目全路径 project_full_path
labels string(可选) 发布标签,允许多个,以,分隔,最多:10
author_id integer(可选) 创建人 id
type string(可选) 发布类型,默认是release,支持 release(发布) 或者 none(基线) 或者 all(全部)
page integer(可选) 分页(default:1
per_page integer(可选) 默认页面大小(default:20,max:100
order_by String(可选) 返回列表的排序字段,可选字段:name、created_at(默认值,将按照 committed_date 字段排序)
sort String(可选) order_by 的排序顺序 ,可选可选字段:asc、desc(默认)

返回值:

[{
  "ref": {
   "name": "01api",
   "message": "01api",
   "commit": {
    "id": "44500ce35ff269d36925aab3a53dac296a91b19f",
    "message": "Merge branch 'dev' into 'master'See merge request !3",
    "parent_ids": [
     "6145857bfd5858b3ed1a5bff4dc4cfc4b62e29ff",
     "3dad4be822a900f5b8ab7a0112da0be5ed76deba"
    ],
    "authored_date": "2016-12-20T02:14:01+0000",
    "author_name": "bili",
    "author_email": "bili@tencent.com",
    "committed_date": "2016-12-20T02:14:01+0000",
    "committer_name": "bili",
    "committer_email": "bili@tencent.com",
    "title": "Merge branch '33' into 'master'",
    "created_at": "2016-12-20T02:14:01+0000",
    "short_id": "44500ce3"
   }
  },
  "id": 2761,
  "project_id": 85436,
  "tag": "01api",
  "title": "01api",
  "type": "release",
  "attachments": [{
    "name": "attachment.svg",
    "type": "image/svg+xml",
    "size": 19208,
    "created_at": "2019-03-08T09:23:35+0000"
   },
   {
    "name": "attachment.png",
    "type": "image/png",
    "size": 19208,
    "created_at": "2019-03-08T09:28:27+0000"
   }
  ],
  "description": null,
  "created_at": "2016-12-20T03:21:31+0000",
  "updated_at": null,
  "author": null
 },
 {
  "ref": {
   "name": "02api",
   "message": "merged",
   "commit": {
    "id": "44200ce35ff269d36925aab3a53dac296a91b19p",
    "message": "Merge branch '33' into 'master'\r\n\r\n保护分支 master\r\n\r\n33\r\n\r\nSee merge request !3",
    "parent_ids": [
     "6146757bfd5858b3ed1a5bff4dc4cfc4b62e29aa",
     "3dad4af822a900f5b8ab7a0112da0be5ed76debb"
    ],
    "authored_date": "2016-12-20T02:14:01+0000",
    "author_name": "",
    "author_email": "bili@tencent.com",
    "committed_date": "2016-12-20T02:14:01+0000",
    "committer_name": "bili",
    "committer_email": "bili@tencent.com",
    "title": "Merge branch '33' into 'master'",
    "created_at": "2016-12-20T02:14:01+0000",
    "short_id": "44200ce3"
   }
  },
  "id": 2795,
  "project_id": 85436,
  "tag": "02api",
  "title": "test",
  "type": "release",
  "attachments": [],
  "description": "test",
  "created_at": "2016-12-20T06:13:06+0000",
  "updated_at": null,
  "author": null
 }
]

# 获取某个指定的 release

在项目版本库中获取某个指定的 release

GET /api/v3/projects/:id/releases/:tag_name

参数:

参数 类型 描述
id integer 或 string 项目 ID 或 项目全路径 project_full_path
tag_name String release 的 tag 字段

返回值:

{
 "ref": {
  "name": "01api",
  "message": "01api",
  "commit": {
   "id": "44500ce35ff269d36925aab3a53dac296a91b19f",
   "message": "Merge branch 'dev' into 'master'See merge request !3",
   "parent_ids": [
    "6145857bfd5858b3ed1a5bff4dc4cfc4b62e29ff",
    "3dad4be822a900f5b8ab7a0112da0be5ed76deba"
   ],
   "authored_date": "2016-12-20T02:14:01+0000",
   "author_name": "bili",
   "author_email": "bili@tencent.com",
   "committed_date": "2016-12-20T02:14:01+0000",
   "committer_name": "bili",
   "committer_email": "bili@tencent.com",
   "title": "Merge branch '33' into 'master'",
   "created_at": "2016-12-20T02:14:01+0000",
   "short_id": "44500ce3"
  }
 },
 "id": 2761,
 "project_id": 85436,
 "tag": "01api",
 "title": "01api",
 "type": "release",
 "attachments": [{
   "name": "attachment.svg",
   "type": "image/svg+xml",
   "size": 19208,
   "created_at": "2019-03-08T09:23:35+0000"
  },
  {
   "name": "attachment.png",
   "type": "image/png",
   "size": 19208,
   "created_at": "2019-03-08T09:28:27+0000"
  }
 ],
 "description": null,
 "created_at": "2016-12-20T03:21:31+0000",
 "updated_at": null,
 "author": null
}

# 新增 release 或 tag

在项目版本库中新增一个 release 或 tag

POST /api/v3/projects/:id/releases

参数:

参数 类型 描述
id integer 或 string 项目 ID 或 项目全路径 project_full_path
tag string tag 名
start_point string 从 commit hash、存在的 branch 或 tag 创建 releases
tag_message string(可选) 对 tag 的附注(仅tag未被创建时有效,如果是基于tag创建release,则此参数无效)
type string(可选) 发布类型,默认release (type 为release的发布将会出现在版本发布列表中,如果不想显示,仅作为基线(tag),则传字符串none)
description string(可选) 对 release 的描述
labels string(可选) 发布标签,允许多个,以,分隔,最多:10

返回值:

{
    "ref": {
        "name": "01api",
        "message": "01api",
        "commit": {
            "id": "44500ce35ff269d36925aab3a53dac296a91b19f",
            "message": "Merge branch 'dev' into 'master'See merge request !3",
            "parent_ids": [
                "6145857bfd5858b3ed1a5bff4dc4cfc4b62e29ff",
                "3dad4be822a900f5b8ab7a0112da0be5ed76deba"
            ],
            "authored_date": "2016-12-20T02:14:01+0000",
            "author_name": "bili",
            "author_email": "bili@tencent.com",
            "committed_date": "2016-12-20T02:14:01+0000",
            "committer_name": "bili",
            "committer_email": "bili@tencent.com",
            "title": "Merge branch '33' into 'master'",
            "created_at": "2016-12-20T02:14:01+0000",
            "short_id": "44500ce3"
        }
    },
    "id": 2761,
    "project_id": 85436,
    "tag": "01api",
    "title": "01api",
    "type": "release",
    "attachments": [],
    "description": null,
    "created_at": "2016-12-20T03:21:31+0000",
    "updated_at": null,
    "author": null
}

# 更新 release 或 tag

在项目版本库中更新指定的 release 或 tag

PUT /api/v3/projects/:id/releases/:tag_name

参数:

参数 类型 描述
id integer 或 string 项目 ID 或 项目全路径 project_full_path
tag_name string tag 名
type string(可选) 发布类型,默认release (type 为release的发布将会出现在版本发布列表中,如果不想显示,仅作为基线(tag),则传字符串none)
description string(可选) 对 release 的描述
labels string(可选) 发布标签,允许多个,以,分隔,最多:10

返回值:

{
 "ref": {
  "name": "01api",
  "message": "01api",
  "commit": {
   "id": "44500ce35ff269d36925aab3a53dac296a91b19f",
   "message": "Merge branch 'dev' into 'master'See merge request !3",
   "parent_ids": [
    "6145857bfd5858b3ed1a5bff4dc4cfc4b62e29ff",
    "3dad4be822a900f5b8ab7a0112da0be5ed76deba"
   ],
   "authored_date": "2016-12-20T02:14:01+0000",
   "author_name": "bili",
   "author_email": "bili@tencent.com",
   "committed_date": "2016-12-20T02:14:01+0000",
   "committer_name": "bili",
   "committer_email": "bili@tencent.com",
   "title": "Merge branch '33' into 'master'",
   "created_at": "2016-12-20T02:14:01+0000",
   "short_id": "44500ce3"
  }
 },
 "id": 2761,
 "project_id": 85436,
 "tag": "01api",
 "title": "01api",
 "type": "release",
 "attachments": [],
 "description": null,
 "created_at": "2016-12-20T03:21:31+0000",
 "updated_at": null,
 "author": null
}

# 删除 release

删除项目版本库 release,此接口会删除 release 绑定的label、附件和描述信息,使其变成普通的 tag,也可完全删除相关 tag,需要有项目的 admin 权限

DELETE /api/v3/projects/:id/releases/:tag_name

参数:

参数 类型 描述
id integer 或 string 项目 ID 或 项目全路径 project_full_path
tag_name string tag 名
delete_tag boolean(可选) 是否删除 tag,默认false

返回值:

200或相关状态码

# 上传附件

注意: 需要Content-type设置为:multipart/form-data,否则无法正常上传附件 工蜂会对文件名进行特殊字符的过滤,最终上传的文件名以返回值中的name字段为准

POST /api/v3/projects/:id/releases/:tag_name/attachments

参数:

参数 类型 描述
id integer 或 string 项目 ID 或 项目全路径 project_full_path
tag_name string tag 名
file - 单个附件:大小不超过 200M

返回值:

{
    "name": "filename.txt",
    "size": 123,
    "type": "plain/txt",
    "created_at": "2016-12-20T03:21:31+0000"
}

# 下载附件

GET /api/v3/projects/:id/releases/:tag_name/attachments/:attachment_name

参数:

参数 类型 描述
id integer 或 string 项目 ID 或 项目全路径 project_full_path
tag_name string tag 名
attachment_name string 附件名

返回值:

文件流

# 删除附件

DELETE /api/v3/projects/:id/releases/:tag_name/attachments/:attachment_name

参数:

参数 类型 描述
id integer 或 string 项目 ID 或 项目全路径 project_full_path
tag_name string tag 名
attachment_name string 附件名

返回值:

200或相关状态码
lastUpdate: 4/10/2026, 11:31:11 AM