Skip to content

Instantly share code, notes, and snippets.

@joecks
Created May 15, 2022 07:36
Show Gist options
  • Save joecks/ea4e8277f4f6267d527e9c9925bcb003 to your computer and use it in GitHub Desktop.
Save joecks/ea4e8277f4f6267d527e9c9925bcb003 to your computer and use it in GitHub Desktop.
desc "Build and publish to MS AppCenter \n" \
"Available options:\n" \
"#{Options::help()}"
lane :publish do |options|
platform = options[Options::PLATFORM]
flavor = options[Options::FLAVOR]
config = Config::FLAVOR_MATRIX[flavor][platform]
appcenter_target = config[Keys::APPCENTER_TARGET]
appcenter_token = config[Keys::APPCENTER_TOKEN]
if isAndroid(options)
android_prepare_key_properties(options)
end
output = flutter_build(options)
appcenter_buildfile = output[/.*Built (.*\.(?:aab|ipa|apk))/, 1]
if isIos(options)
Dir.chdir("../ios/fastlane") do
ios_create_ipa(options)
appcenter_buildfile = options[:ios_create_ipa]
end
end
if options[Options::UPLOAD_TO_APPCENTER]
UI.success "Will upload file #{appcenter_buildfile}"
UI.user_error!("No $#{appcenter_token} provided!") unless ENV.key?(appcenter_token)
version = options[Options::VERSION_NAME]
if options[Options::STORE]
uploadToStore(
ENV[appcenter_token],
appcenter_target,
appcenter_buildfile,
version,
# maxChangeLogSize
isAndroid(options) ? 500 : -1
)
else
uploadToAppCenter(
ENV[appcenter_token],
appcenter_target,
appcenter_buildfile,
version
)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment