Class: Fastlane::Actions::UploadToTestappioAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::UploadToTestappioAction
- Defined in:
- lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb
Constant Summary collapse
- SUPPORTED_FILE_EXTENSIONS =
["apk", "ipa"]
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .default_file_path ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
- .run(params) ⇒ Object
- .validate_file_path(file_path) ⇒ Object
Class Method Details
.authors ⇒ Object
155 156 157 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 155 def self. ["TestApp.io"] end |
.available_options ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 83 def self. # Define all options your action supports. # Below a few examples [ FastlaneCore::ConfigItem.new(key: :api_token, env_name: "TESTAPPIO_API_TOKEN", description: "You can get it from https://portal.testapp.io/settings/api-credentials", verify_block: proc do |value| UI.user_error!("No API token provided. You can get it from https://portal.testapp.io/settings/api-credentials") unless value && !value.empty? end), FastlaneCore::ConfigItem.new(key: :app_id, env_name: "TESTAPPIO_APP_ID", description: "You can get it from your app page in https://portal.testapp.io/apps?action=select-for-integrations", is_string: false), FastlaneCore::ConfigItem.new(key: :release, env_name: "TESTAPPIO_RELEASE", description: "It can be either both or android or ios", is_string: true, default_value: Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]), FastlaneCore::ConfigItem.new(key: :apk_file, env_name: "TESTAPPIO_ANDROID_PATH", description: "Full path to the Android .apk file", optional: true, is_string: true, default_value: default_file_path), FastlaneCore::ConfigItem.new(key: :ipa_file, env_name: "TESTAPPIO_IOS_PATH", description: "Full path to the iOS .ipa file", optional: true, is_string: true, default_value: default_file_path), FastlaneCore::ConfigItem.new(key: :release_notes, env_name: "TESTAPPIO_RELEASE_NOTES", description: "Manually add the release notes to be displayed for the testers", optional: true, is_string: true), FastlaneCore::ConfigItem.new(key: :git_release_notes, env_name: "TESTAPPIO_GIT_RELEASE_NOTES", description: "Collect release notes from the latest git commit message to be displayed for the testers: true or false", optional: true, is_string: false, default_value: true), FastlaneCore::ConfigItem.new(key: :git_commit_id, env_name: "TESTAPPIO_GIT_COMMIT_ID", description: "Include the last commit ID in the release notes (works with both release notes option): true or false", optional: true, is_string: false, default_value: false), FastlaneCore::ConfigItem.new(key: :notify, env_name: "TESTAPPIO_NOTIFY", description: "Send notificaitons to your team members about this release: true or false", optional: true, is_string: false, default_value: false), FastlaneCore::ConfigItem.new(key: :self_update, env_name: "TESTAPPIO_SELF_UPDATE", description: "Automatically update ta-cli if a new version is available or required: true or false", optional: true, is_string: false, default_value: true) ] end |
.default_file_path ⇒ Object
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 68 def self.default_file_path platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME] if platform == :ios # Shared value for ipa path if it was generated by gym https://docs.fastlane.tools/actions/gym/. return Actions.lane_context[Actions::SharedValues::IPA_OUTPUT_PATH] else # Shared value for apk if it was generated by gradle. return Actions.lane_context[Actions::SharedValues::GRADLE_APK_OUTPUT_PATH] end end |
.description ⇒ Object
64 65 66 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 64 def self.description "Uploading ipa/apk packages to TestApp.io for testing." end |
.details ⇒ Object
79 80 81 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 79 def self.details "This Fastlane plugin uploads your Android (APK) and iOS (IPA) package to TestApp.io and notify your team members about the new releases if you enable it." end |
.is_supported?(platform) ⇒ Boolean
159 160 161 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 159 def self.is_supported?(platform) [:ios, :android].include?(platform) end |
.output ⇒ Object
147 148 149 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 147 def self.output nil end |
.return_value ⇒ Object
151 152 153 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 151 def self.return_value nill end |
.run(params) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 6 def self.run(params) # Check if `ta_cli` exists, install it if not unless Helper::TestappioHelper.check_ta_cli UI.error("Error detecting ta-cli") return end api_token = params[:api_token] app_id = params[:app_id] apk_file = params[:apk_file] ipa_file = params[:ipa_file] release = params[:release] release_notes = params[:release_notes] git_release_notes = params[:git_release_notes] git_commit_id = params[:git_commit_id] notify = params[:notify] self_update = params[:self_update] # Check if ta-cli needs to be updated unless Helper::TestappioHelper.check_update(self_update) UI.error("Error updating ta-cli") return end validate_file_path(apk_file) unless release == "ios" validate_file_path(ipa_file) unless release == "android" command = ["ta-cli", "publish", "--api_token=#{api_token}", "--app_id=#{app_id}", "--release=#{release}"] command.push("--apk=#{apk_file}") unless release == "ios" command.push("--ipa=#{ipa_file}") unless release == "android" command += ["--release_notes=#{release_notes}", "--git_release_notes=#{git_release_notes}", "--git_commit_id=#{git_commit_id}", "--notify=#{notify}", "--self_update=#{self_update}", "--source=Fastlane", "--source_version=#{Fastlane::Testappio::VERSION}"] UI.("Uploading to TestApp.io") Helper::TestappioHelper.call_ta_cli(command) UI.success("Successfully uploaded to TestApp.io!") end |
.validate_file_path(file_path) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 55 def self.validate_file_path(file_path) UI.user_error!("No file found at '#{file_path}'.") unless File.exist?(file_path) file_ext = File.extname(file_path).delete('.') unless SUPPORTED_FILE_EXTENSIONS.include?(file_ext) UI.user_error!("file_path is invalid, only files with extensions #{SUPPORTED_FILE_EXTENSIONS} are allowed to be uploaded.") end end |