-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add action to publish release on GitHub (#585)
Publish Release Action
- Loading branch information
Showing
8 changed files
with
262 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
lib/fastlane/plugin/wpmreleasetoolkit/actions/common/publish_github_release_action.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
require 'fastlane/action' | ||
require_relative '../../helper/github_helper' | ||
|
||
module Fastlane | ||
module Actions | ||
class PublishGithubReleaseAction < Action | ||
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 | ||
|
||
def self.description | ||
'Publish an existing GitHub Release still in draft mode' | ||
end | ||
|
||
def self.authors | ||
['Automattic'] | ||
end | ||
|
||
def self.return_value | ||
'The URL of the published GitHub Release' | ||
end | ||
|
||
def self.details | ||
'Publish an existing GitHub Release still in draft mode' | ||
end | ||
|
||
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 | ||
|
||
def self.is_supported?(platform) | ||
true | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.