Module: Gitlab::Client::ProjectReleases

Included in:
Gitlab::Client
Defined in:
lib/gitlab/client/project_releases.rb

Overview

Defines methods related to project releases.

Instance Method Summary collapse

Instance Method Details

#create_project_release(project, options = {}) ⇒ Gitlab::ObjectifiedHash

Creates a Release. You need push access to the repository to create a Release.

Examples:

Gitlab.create_project_release(5, { name: 'New Release', tag_name: 'v0.3', description: 'Super nice release' })
Gitlab.create_project_release(5, { name: 'New Release', tag_name: 'v0.3', description: 'Super nice release', assets: { links: [{ name: 'hoge', url: 'https://google.com' }] } })

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :name(required) (String)

    The release name.

  • :tag_name(required) (String)

    The tag where the release will be created from.

  • :description(required) (String)

    The description of the release. You can use markdown.

  • :ref(optional) (String)

    If tag_name does not exist, the release will be created from ref. It can be a commit SHA, another tag name, or a branch name.

  • :assets(optional) (Hash)

    A customizable set of options for release assets

Returns:



48
49
50
# File 'lib/gitlab/client/project_releases.rb', line 48

def create_project_release(project, options = {})
  post("/projects/#{url_encode project}/releases", body: options)
end

#delete_project_release(project, tag_name) ⇒ Gitlab::ObjectifiedHash

Delete a Release. Deleting a Release will not delete the associated tag.

Examples:

Gitlab.delete_project_release(5, 'v0.3')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • tag_name (String)

    The tag where the release will be created from.

Returns:



75
76
77
# File 'lib/gitlab/client/project_releases.rb', line 75

def delete_project_release(project, tag_name)
  delete("/projects/#{url_encode project}/releases/#{tag_name}")
end

#project_release(project, tag_name) ⇒ Gitlab::ObjectifiedHash

Gets a Release by a tag name

Examples:

Gitlab.project_release(5, 'v0.1')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • tag_name (String)

    The tag where the release will be created from..

Returns:



26
27
28
# File 'lib/gitlab/client/project_releases.rb', line 26

def project_release(project, tag_name)
  get("/projects/#{url_encode project}/releases/#{tag_name}")
end

#project_releases(project) ⇒ Array<Gitlab::ObjectifiedHash>

Returns Paginated list of a project’s releases, sorted by created_at.

Examples:

Gitlab.project_releases(5)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

Returns:



14
15
16
# File 'lib/gitlab/client/project_releases.rb', line 14

def project_releases(project)
  get("/projects/#{url_encode project}/releases")
end

#update_project_release(project, tag_name, options = {}) ⇒ Gitlab::ObjectifiedHash

Updates a release.

Examples:

Gitlab.update_project_release(5, 'v0.3', { name: 'New Release', description: 'Super nice release' })

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • tag_name (String)

    The tag where the release will be created from.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :name(optional) (String)

    The release name.

  • :description(optional) (String)

    The description of the release. You can use markdown.

Returns:



63
64
65
# File 'lib/gitlab/client/project_releases.rb', line 63

def update_project_release(project, tag_name, options = {})
  put("/projects/#{url_encode project}/releases/#{tag_name}", body: options)
end