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
156 157 158 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 156 def self. ["TestApp.io"] end |
.available_options ⇒ Object
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 146 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 84 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/profile/tokens", verify_block: proc do |value| UI.user_error!("No API token provided. You can get it from https://portal.testapp.io/profile/tokens") 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?to=app-integrations&tab=releases", 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
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 69 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
65 66 67 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 65 def self.description "Uploading ipa/apk packages to TestApp.io for testing." end |
.details ⇒ Object
80 81 82 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 80 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
160 161 162 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 160 def self.is_supported?(platform) [:ios, :android].include?(platform) end |
.output ⇒ Object
148 149 150 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 148 def self.output nil end |
.return_value ⇒ Object
152 153 154 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 152 def self.return_value nil 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 |
# 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
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/fastlane/plugin/testappio/actions/upload_to_testappio.rb', line 54 def self.validate_file_path(file_path) return if file_path.nil? 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 |