Skip to content

Instantly share code, notes, and snippets.

@kcharwood
Created October 10, 2017 18:31
Show Gist options
  • Save kcharwood/dd9b3882f0aa43bc03cfcfaf145e992d to your computer and use it in GitHub Desktop.
Save kcharwood/dd9b3882f0aa43bc03cfcfaf145e992d to your computer and use it in GitHub Desktop.
SimpleMDM Fastlane Action
require "SimpleMDM"
module Fastlane
module Actions
module SharedValues
end
class UploadToSimplemdmAction < Action
def self.run(params)
SimpleMDM.api_key = "#{params[:api_key]}"
data = File.open("#{params[:ipa_path]}")
app = SimpleMDM::App.find(params[:app_id])
app.binary = data
UI.message "Uploading `#{params[:ipa_path]}` to SimpleMDM for app ID #{params[:app_id]}"
app.save
end
def self.description
"Upload IPA to Simple MDM"
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :api_key,
env_name: "SIMPLEMDM_API_KEY", # The name of the environment variable
description: "API Token for SimpleMDM"), # a short description of this parameter
FastlaneCore::ConfigItem.new(key: :app_id,
env_name: "SIMPLEMDM_APP_ID",
description: "The SimpleMDM App ID that will be uploaded",
is_string:false),
FastlaneCore::ConfigItem.new(key: :ipa_path,
env_name: "SIMPLEMDM_IPA_PATH",
description: "The the path to the IPA",
default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
verify_block: proc do |value|
UI.user_error!("Couldn't find ipa file at path '#{value}'") unless File.exist?(value)
end)
]
end
def self.authors
["kcharwood"]
end
def self.is_supported?(platform)
platform == :ios
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment