Class: Fastlane::Actions::UploadToGitlabAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::UploadToGitlabAction
- Defined in:
- lib/fastlane/plugin/upload_to_gitlab/actions/upload_to_gitlab_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
33 34 35 |
# File 'lib/fastlane/plugin/upload_to_gitlab/actions/upload_to_gitlab_action.rb', line 33 def self. ["Hackintosh 5"] end |
.available_options ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/fastlane/plugin/upload_to_gitlab/actions/upload_to_gitlab_action.rb', line 46 def self. [ FastlaneCore::ConfigItem.new(key: :project_id, env_name: "GITLAB_PROJECT_ID", description: "The project ID where releases should be pushed to", optional: false, type: Integer), FastlaneCore::ConfigItem.new(key: :token, env_name: "GITLAB_TOKEN", description: "The GitLab Bearer authentication token", code_gen_sensitive: true, optional: false, type: String), FastlaneCore::ConfigItem.new(key: :base_url, env_name: "GITLAB_BASE_URL", description: "The base URL of the GitLab API (including the protocol and trailing slash)", optional: true, default_value: "https://gitlab.com/api/v4/", type: String), FastlaneCore::ConfigItem.new(key: :version_name, env_name: "GITLAB_VERSION_NAME", description: "The version name to use for the asset upload", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :asset_paths, env_name: "GITLAB_ASSET_PATHS", description: "A hash of filename: filepath", optional: false, type: Hash) ] end |
.description ⇒ Object
29 30 31 |
# File 'lib/fastlane/plugin/upload_to_gitlab/actions/upload_to_gitlab_action.rb', line 29 def self.description "Fastlane plugin to upload releases to GitLab" end |
.details ⇒ Object
41 42 43 44 |
# File 'lib/fastlane/plugin/upload_to_gitlab/actions/upload_to_gitlab_action.rb', line 41 def self.details # Optional: "Provides a quick and easy way to upload tagged releases to GitLab" end |
.is_supported?(platform) ⇒ Boolean
78 79 80 |
# File 'lib/fastlane/plugin/upload_to_gitlab/actions/upload_to_gitlab_action.rb', line 78 def self.is_supported?(platform) true end |
.return_value ⇒ Object
37 38 39 |
# File 'lib/fastlane/plugin/upload_to_gitlab/actions/upload_to_gitlab_action.rb', line 37 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fastlane/plugin/upload_to_gitlab/actions/upload_to_gitlab_action.rb', line 7 def self.run(params) version = params[:version_name] project_id = params[:project_id] token = params[:token].strip base_url = params[:base_url] base_uri = URI(base_url) asset_paths = params[:asset_paths] Net::HTTP.start(base_uri.host, base_uri.port, use_ssl: base_uri.scheme == "https") do |http| assets_links = asset_paths.map do |asset_name, asset_path| release_url = "#{base_url}/projects/#{project_id}/packages/generic/apk/#{version}/#{asset_name}" release_uri = URI(release_url) UI.verbose("Uploading asset to #{release_url}") final_url = Helper::UploadToGitlabHelper.upload_file(http, release_uri, token, asset_path) { name: asset_name, url: final_url, link_type: "package" } end Helper::UploadToGitlabHelper.create_release(http, base_url, project_id, token, version, assets_links) UI.success("Created GitLab release") end end |