fastlane-plugin-shorebird 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ce08cc5837ec5f3081731726d4c695f6dc6f32ba0758a8fbf699e0682ded09a
4
- data.tar.gz: 9cdb3863b127508f37e06c5a822a10e4a5d53de7a61119dec786e69b5afa4ad2
3
+ metadata.gz: 9b036de6c7699f4fdd2c1f3a5babe877e11f1820a747233a28ad4b30300f3e06
4
+ data.tar.gz: 74f912f946184dfbc6d9afb04ef9753cfa2ab44ab8fb66dc65a3548485b6a191
5
5
  SHA512:
6
- metadata.gz: 3ece6e4e48c54e892d5ffc1fb150f0734dc2746a32277cd27b5ab2b021c4bf47fd27eaea0b2b276c641c24a706a5d180a8e3daadc5f5c628958a49b8bc102092
7
- data.tar.gz: af71067070f017aa5e12854f89395e7da4677e8ce99a49c49030e74022cfc3ccb1cf369ee3ea63af9e39d24d18570e918180cdfb2e2911ff2ab1106a7b40e50b
6
+ metadata.gz: c719fdb1f7859c6730e4f4e0a113fec5f852e6ee0af577000d97c0601ade818046a3a18eda8b47cb43d64ce3aab3b3c420f2e7f137121bc5c59eb18847dd589c
7
+ data.tar.gz: cde015fcf74a485e2ce5ed66fb07f356bbe0c9bbd9389e1c8b4191643e9e66af2d6f60e92eb17531752522a1ab220a0b9398c11bd6a91c457273dfee458dbe3c
@@ -1,22 +1,45 @@
1
1
  require 'fastlane/action'
2
2
  require_relative '../helper/shorebird_helper'
3
+ require 'gym'
4
+ require 'plist'
5
+ require 'tempfile'
3
6
 
4
7
  module Fastlane
5
8
  module Actions
6
9
  class ShorebirdReleaseAction < Action
7
10
  def self.run(params)
8
11
  platform = params[:platform]
9
- Fastlane::Actions.sh("shorebird release #{platform} #{params[:args]}".strip)
12
+ params[:args] ||= ""
10
13
 
11
14
  if platform == "ios"
12
- # Get the most recently-created IPA file
13
- ipa_file = Dir.glob('../build/ios/ipa/*.ipa')
14
- .sort_by! { |f| File.stat(f).ctime }
15
- .reverse!
16
- .first
17
- puts("Setting IPA_OUTPUT_PATH to #{ipa_file}")
18
- lane_context[SharedValues::IPA_OUTPUT_PATH] = ipa_file
15
+ if export_options_plist_in_args?(params)
16
+ # If the user is already providing an export options plist, warn
17
+ UI.deprecated("--export-options-plist should not be passed in the args parameter. Please use the export_options parameter instead.")
18
+ else
19
+ provisioning_profile_mapping = Fastlane::Actions.lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING]
20
+ export_options_plist_path = Helper::ExportOptionsPlist.generate_export_options_plist(params[:export_options], provisioning_profile_mapping)
21
+ optional_space = (params[:args].end_with?(" ") || params[:args].empty?) ? "" : " "
22
+ params[:args] = params[:args] + "#{optional_space}--export-options-plist #{export_options_plist_path}"
23
+ end
19
24
  end
25
+
26
+ command = "shorebird release #{platform} #{params[:args]}".strip
27
+ Fastlane::Actions.sh(command)
28
+
29
+ if platform == "ios"
30
+ lane_context[SharedValues::IPA_OUTPUT_PATH] = most_recent_ipa_file
31
+ end
32
+ end
33
+
34
+ def self.most_recent_ipa_file
35
+ Dir.glob('../build/ios/ipa/*.ipa')
36
+ .sort_by! { |f| File.stat(f).ctime }
37
+ .reverse!
38
+ .first
39
+ end
40
+
41
+ def self.export_options_plist_in_args?(params)
42
+ params[:args].include?("--export-options-plist")
20
43
  end
21
44
 
22
45
  def self.description
@@ -45,6 +68,14 @@ module Fastlane
45
68
  optional: true,
46
69
  type: String,
47
70
  default_value: ""
71
+ ),
72
+ FastlaneCore::ConfigItem.new(
73
+ key: :export_options,
74
+ description: "Path to an export options plist or a hash with export options. Use 'xcodebuild -help' to print the full set of available options",
75
+ optional: true,
76
+ type: Hash,
77
+ skip_type_validation: true,
78
+ default_value: {}
48
79
  )
49
80
  ]
50
81
  end
@@ -0,0 +1,45 @@
1
+ module Fastlane
2
+ module Helper
3
+ class ExportOptionsPlist
4
+ # Generates an export options plist for use with Shorebird.
5
+ # In addition to handling data produced by match, it also updates the
6
+ # export options to ensure that the build number is not managed by Xcode
7
+ # and that the release method is set to app-store.
8
+ #
9
+ # @param export_options [Hash, String] The export options to use. If a hash, it will be used directly. If a string, it will be parsed as a plist file.
10
+ # @param provisioning_profile_mapping [Hash] The provisioning profile mapping from match. If provided, the provisioning profiles will be added to the export options plist.
11
+ # @return [String] The path to the generated export options plist.
12
+ def self.generate_export_options_plist(export_options, provisioning_profile_mapping = nil)
13
+ export_options_hash = {}
14
+ if export_options.kind_of?(Hash)
15
+ export_options_hash = export_options
16
+ export_options_hash[:method] = "app-store"
17
+ if provisioning_profile_mapping
18
+ # If match has provided provisioning profiles, put them in the export options plist
19
+ export_options_hash[:provisioningProfiles] = provisioning_profile_mapping
20
+ export_options_hash[:signingStyle] = 'manual'
21
+ end
22
+ elsif export_options.kind_of?(String)
23
+ export_options_path = File.expand_path(export_options)
24
+ unless File.exist?(export_options_path)
25
+ raise "export_options path #{export_options_path} does not exist"
26
+ end
27
+
28
+ export_options_hash = Plist.parse_xml(export_options_path)
29
+ end
30
+
31
+ # If manageAppVersionAndBuildNumber is not false, Shorebird won't
32
+ # work. If set to true (or not provided), Xcode will change the build
33
+ # number *after* the release is created, causing the app to be
34
+ # unpatchable.
35
+ export_options_hash[:manageAppVersionAndBuildNumber] = false
36
+ export_options_hash.compact!
37
+
38
+ tmp_path = Dir.mktmpdir('shorebird')
39
+ plist_path = File.join(tmp_path, "ExportOptions.plist")
40
+ File.write(plist_path, export_options_hash.to_plist)
41
+ plist_path
42
+ end
43
+ end
44
+ end
45
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Shorebird
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,16 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-shorebird
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shorebird
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-07-30 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
- description:
14
12
  email: contact@shorebird.dev
15
13
  executables: []
16
14
  extensions: []
@@ -21,6 +19,7 @@ files:
21
19
  - lib/fastlane/plugin/shorebird.rb
22
20
  - lib/fastlane/plugin/shorebird/actions/shorebird_patch_action.rb
23
21
  - lib/fastlane/plugin/shorebird/actions/shorebird_release_action.rb
22
+ - lib/fastlane/plugin/shorebird/helper/export_options_plist.rb
24
23
  - lib/fastlane/plugin/shorebird/helper/shorebird_helper.rb
25
24
  - lib/fastlane/plugin/shorebird/version.rb
26
25
  homepage: https://github.com/shorebirdtech/fastlane-plugin-shorebird
@@ -28,7 +27,6 @@ licenses:
28
27
  - MIT
29
28
  metadata:
30
29
  rubygems_mfa_required: 'true'
31
- post_install_message:
32
30
  rdoc_options: []
33
31
  require_paths:
34
32
  - lib
@@ -43,8 +41,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
43
41
  - !ruby/object:Gem::Version
44
42
  version: '0'
45
43
  requirements: []
46
- rubygems_version: 3.5.16
47
- signing_key:
44
+ rubygems_version: 3.6.9
48
45
  specification_version: 4
49
46
  summary: Create Shorebird releases and patches
50
47
  test_files: []