Class: Fastlane::Actions::PublishGithubReleaseAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/wpmreleasetoolkit/actions/common/publish_github_release_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



27
28
29
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/publish_github_release_action.rb', line 27

def self.authors
  ['Automattic']
end

.available_optionsObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/publish_github_release_action.rb', line 39

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :repository,
                                 description: 'The slug (`<org>/<repo>`) of the GitHub repository we want to create the release on',
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :name,
                                 description: 'The name (aka title) of the draft release to publish',
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :prerelease,
                                 description: 'True to publish as a pre-release. False to published as final. Don\'t provide a value to keep the same (non-)prerelease status as the one used in the Draft',
                                 optional: true,
                                 default_value: :unchanged,
                                 type: Boolean),
    Fastlane::Helper::GithubHelper.github_token_config_item,
  ]
end

.descriptionObject



23
24
25
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/publish_github_release_action.rb', line 23

def self.description
  'Publish an existing GitHub Release still in draft mode'
end

.detailsObject



35
36
37
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/publish_github_release_action.rb', line 35

def self.details
  'Publish an existing GitHub Release still in draft mode'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/publish_github_release_action.rb', line 58

def self.is_supported?(platform)
  true
end

.return_valueObject



31
32
33
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/publish_github_release_action.rb', line 31

def self.return_value
  'The URL of the published GitHub Release'
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/publish_github_release_action.rb', line 7

def self.run(params)
  repository = params[:repository]
  name = params[:name]
  prerelease = params[:prerelease]

  github_helper = Fastlane::Helper::GithubHelper.new(github_token: params[:github_token])

  url = github_helper.publish_release(
    repository: repository,
    name: name,
    prerelease: prerelease == :unchanged ? nil : prerelease
  )
  UI.success("Successfully published GitHub Release #{name}. You can see it at '#{url}'")
  url
end