gitlib中有版本控制,如下图,具体可参考官方api
先创建Tag
Release必须和Tag关联(官方新建标签,不解释)
创建Access Token
获取项目ID
命令
- 查看所有Release
GET ip/projects/:id/releases
curl --header "PRIVATE-TOKEN: XXXXXXXXXXXXX" http://ip地址/api/v4/projects/工程id/releases
- 创建Release
curl --header 'Content-Type: application/json' --header "PRIVATE-TOKEN: XXXXXXXXXXXXX" --data '{ "name": "'release名称'", "tag_name": "'标签名'", "ref":"'标签名'" ,"description": "'描述信息'" }' --request POST http://ip地址/api/v4/projects/工程id/releases
- 修改Release
curl --request PUT --data name="new name" --header "PRIVATE-TOKEN: XXX" "http://id地址/api/v4/projects/工程id/releases/标签名"
- 创建外部链接文件
curl --request POST --header "PRIVATE-TOKEN: $token" --data name="名字" --data url="链接地址" "http://ip地址/api/v4/projects/工程id/releases/标签名/assets/links"
- 脚本
!/usr/bin/env bash
GITLAB_URL="172.18.20.41"
echo -n "0.请输入Gitlab Access Token:"
read token
echo -n "1.请输入项目的id:"
read id
echo -n "2.请输入项目release的名称:"
read name
echo -n "3.请输入即将创建release版本的tag:"
read tag_name
echo -n "4.请输入release的描述:"
read description
echo -n "5.请输入release二进制文件名称:"
read release_file_name
echo -n "6.请输入release二进制文件发布路径:"
read release_path
创建发布版本
curl --header 'Content-Type: application/json' --header "PRIVATE-TOKEN: name'", "tag_name": "'tag_name'" ,"description": "'GITLAB_URL/api/v4/projects/$id/releases
创建二进制文件链接
curl --request POST --header "PRIVATE-TOKEN: release_file_name" --data url="GITLAB_URL/api/v4/projects/tag_name/assets/links"