Class: Fastlane::Actions::ShorebirdReleaseAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/shorebird/actions/shorebird_release_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



49
50
51
# File 'lib/fastlane/plugin/shorebird/actions/shorebird_release_action.rb', line 49

def self.authors
  Helper::ShorebirdHelper.authors
end

.available_optionsObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/fastlane/plugin/shorebird/actions/shorebird_release_action.rb', line 57

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :platform,
      description: "Which platform to release to (ios,android)",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :args,
      description: "The argument string to pass to shorebird release",
      optional: true,
      type: String,
      default_value: ""
    ),
    FastlaneCore::ConfigItem.new(
      key: :export_options,
      description: "Path to an export options plist or a hash with export options. Use 'xcodebuild -help' to print the full set of available options",
      optional: true,
      type: Hash,
      skip_type_validation: true,
      default_value: {}
    )
  ]
end

.descriptionObject



45
46
47
# File 'lib/fastlane/plugin/shorebird/actions/shorebird_release_action.rb', line 45

def self.description
  "Create a Shorebird release"
end

.detailsObject



53
54
55
# File 'lib/fastlane/plugin/shorebird/actions/shorebird_release_action.rb', line 53

def self.details
  "Create a Shorebird release for the provided platform with the given arguments."
end

.export_options_plist_in_args?(params) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/fastlane/plugin/shorebird/actions/shorebird_release_action.rb', line 41

def self.export_options_plist_in_args?(params)
  params[:args].include?("--export-options-plist")
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/fastlane/plugin/shorebird/actions/shorebird_release_action.rb', line 83

def self.is_supported?(platform)
  Helper::ShorebirdHelper.supported_platforms.include?(platform)
end

.most_recent_ipa_fileObject



34
35
36
37
38
39
# File 'lib/fastlane/plugin/shorebird/actions/shorebird_release_action.rb', line 34

def self.most_recent_ipa_file
  Dir.glob('../build/ios/ipa/*.ipa')
     .sort_by! { |f| File.stat(f).ctime }
     .reverse!
     .first
end

.run(params) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fastlane/plugin/shorebird/actions/shorebird_release_action.rb', line 10

def self.run(params)
  platform = params[:platform]
  params[:args] ||= ""

  if platform == "ios"
    if export_options_plist_in_args?(params)
      # If the user is already providing an export options plist, warn
      UI.deprecated("--export-options-plist should not be passed in the args parameter. Please use the export_options parameter instead.")
    else
      provisioning_profile_mapping = Fastlane::Actions.lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING]
      export_options_plist_path = Helper::ExportOptionsPlist.generate_export_options_plist(params[:export_options], provisioning_profile_mapping)
      optional_space = (params[:args].end_with?(" ") || params[:args].empty?) ? "" : " "
      params[:args] = params[:args] + "#{optional_space}--export-options-plist #{export_options_plist_path}"
    end
  end

  command = "shorebird release #{platform} #{params[:args]}".strip
  Fastlane::Actions.sh(command)

  if platform == "ios"
    lane_context[SharedValues::IPA_OUTPUT_PATH] = most_recent_ipa_file
  end
end