Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
8f53094f
Commit
8f53094f
authored
Nov 12, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add API docs and correctly expose release api
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
ba34045f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
26 deletions
+57
-26
doc/api/tags.md
doc/api/tags.md
+31
-0
lib/api/entities.rb
lib/api/entities.rb
+25
-25
lib/api/tags.rb
lib/api/tags.rb
+1
-1
No files found.
doc/api/tags.md
View file @
8f53094f
...
...
@@ -28,6 +28,10 @@ Parameters:
"2a4b78934375d7f53875269ffd4f45fd83a84ebe"
]
},
"release"
:
{
"tag"
:
"1.0.0"
,
"description"
:
"Amazing release. Wow"
},
"name"
:
"v1.0.0"
,
"message"
:
null
}
...
...
@@ -48,6 +52,7 @@ Parameters:
-
`tag_name`
(required) - The name of a tag
-
`ref`
(required) - Create tag using commit SHA, another tag name, or branch name.
-
`message`
(optional) - Creates annotated tag.
-
`release_description`
(optional) - Add release notes to the git tag and store it in the GitLab database.
```
json
{
...
...
@@ -64,6 +69,10 @@ Parameters:
"2a4b78934375d7f53875269ffd4f45fd83a84ebe"
]
},
"release"
:
{
"tag"
:
"1.0.0"
,
"description"
:
"Amazing release. Wow"
},
"name"
:
"v1.0.0"
,
"message"
:
null
}
...
...
@@ -73,3 +82,25 @@ it will contain the annotation.
It returns 200 if the operation succeed. In case of an error,
405 with an explaining error message is returned.
## New release
Add release notes to the existing git tag
```
PUT /projects/:id/repository/:tag/release
```
Parameters:
-
`id`
(required) - The ID of a project
-
`tag`
(required) - The name of a tag
-
`description`
(required) - Release notes with markdown support
```
json
{
"tag"
:
"1.0.0"
,
"description"
:
"Amazing release. Wow"
}
```
lib/api/entities.rb
View file @
8f53094f
...
...
@@ -95,31 +95,6 @@ module API
end
end
class
RepoTag
<
Grape
::
Entity
expose
:name
expose
:message
do
|
repo_obj
,
_options
|
if
repo_obj
.
respond_to?
(
:message
)
repo_obj
.
message
else
nil
end
end
expose
:commit
do
|
repo_obj
,
options
|
if
repo_obj
.
respond_to?
(
:commit
)
repo_obj
.
commit
elsif
options
[
:project
]
options
[
:project
].
repository
.
commit
(
repo_obj
.
target
)
end
end
expose
:release
do
|
repo_obj
,
options
|
if
options
[
:project
]
options
[
:project
].
releases
.
find_by
(
tag:
repo_obj
.
name
)
end
end
end
class
RepoObject
<
Grape
::
Entity
expose
:name
...
...
@@ -351,5 +326,30 @@ module API
class
Release
<
Grape
::
Entity
expose
:tag
,
:description
end
class
RepoTag
<
Grape
::
Entity
expose
:name
expose
:message
do
|
repo_obj
,
_options
|
if
repo_obj
.
respond_to?
(
:message
)
repo_obj
.
message
else
nil
end
end
expose
:commit
do
|
repo_obj
,
options
|
if
repo_obj
.
respond_to?
(
:commit
)
repo_obj
.
commit
elsif
options
[
:project
]
options
[
:project
].
repository
.
commit
(
repo_obj
.
target
)
end
end
expose
:release
,
using:
Entities
::
Release
do
|
repo_obj
,
options
|
if
options
[
:project
]
options
[
:project
].
releases
.
find_by
(
tag:
repo_obj
.
name
)
end
end
end
end
end
lib/api/tags.rb
View file @
8f53094f
...
...
@@ -29,7 +29,7 @@ module API
authorize_push_project
message
=
params
[
:message
]
||
nil
result
=
CreateTagService
.
new
(
user_project
,
current_user
).
execute
(
params
[
:tag_name
],
params
[
:ref
],
message
)
execute
(
params
[
:tag_name
],
params
[
:ref
],
message
,
params
[
:release_description
]
)
if
result
[
:status
]
==
:success
present
result
[
:tag
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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