Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
2dca5b03
Commit
2dca5b03
authored
Mar 10, 2017
by
Julien Lafourcade
Browse files
Add an API to create tags in a repository
parent
2ffa20d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/RepositoryApi.java
View file @
2dca5b03
...
...
@@ -73,6 +73,30 @@ public class RepositoryApi extends AbstractApi {
return
(
response
.
readEntity
(
Branch
.
class
));
}
/**
* Creates a tag for the project. Support as of version 6.8.x
*
* POST /projects/:id/repository/tags
*
* @param projectId the project to create the branch for
* @param tagName the name of the tag to create
* @param ref Source to create the tag from, can be an existing branch, tag or commit SHA
* @param message (optional) - Creates annotated tag.
* @param release_description (optional) - Add release notes to the git tag and store it in the GitLab database.
* @return the tag info for the created tag
* @throws GitLabApiException
*/
public
Tag
createTag
(
Integer
projectId
,
String
tagName
,
String
ref
,
String
message
,
String
release_description
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
()
.
withParam
(
"tag_name"
,
tagName
,
true
)
.
withParam
(
"ref"
,
ref
,
true
)
.
withParam
(
"message"
,
message
,
false
)
.
withParam
(
"release_description"
,
release_description
,
false
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
.
asMap
(),
"projects"
,
projectId
,
"repository"
,
"tags"
);
return
(
response
.
readEntity
(
Tag
.
class
));
}
/**
* Delete a single project repository branch. This is an idempotent function,
* protecting an already protected repository branch will not produce an error.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment