fastlane-plugin-shorebird 0.3.0 → 0.5.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: 9b036de6c7699f4fdd2c1f3a5babe877e11f1820a747233a28ad4b30300f3e06
4
- data.tar.gz: 74f912f946184dfbc6d9afb04ef9753cfa2ab44ab8fb66dc65a3548485b6a191
3
+ metadata.gz: cf7bb07e5c738bbbc3091a2420f8f134877d7a3bb143083b2b10a5bbf825e5f2
4
+ data.tar.gz: '085d61324867a395d35e5c54a68b4f25d60d7705e62c3576bde758813b531f46'
5
5
  SHA512:
6
- metadata.gz: c719fdb1f7859c6730e4f4e0a113fec5f852e6ee0af577000d97c0601ade818046a3a18eda8b47cb43d64ce3aab3b3c420f2e7f137121bc5c59eb18847dd589c
7
- data.tar.gz: cde015fcf74a485e2ce5ed66fb07f356bbe0c9bbd9389e1c8b4191643e9e66af2d6f60e92eb17531752522a1ab220a0b9398c11bd6a91c457273dfee458dbe3c
6
+ metadata.gz: 3ca75b014efbfa825d87f5188231511d9eb8799798f6eda2775f8045cf78de3e4dee9df77429a09d6409fd9aa7d725603cfce4577424c45a4533fc5545ad90c8
7
+ data.tar.gz: 3b672804d2b11073e34cf37b1ccb06e4e6b84bb2eb80f11f308198c676a464eaf623232cd3a389269e02c1c682972b6fc2abb072744e7922687a427381836d83
data/README.md CHANGED
@@ -18,7 +18,7 @@ This plugin makes it easy to create Shorebird releases and patches.
18
18
 
19
19
  This plugin is designed to work with Flutter apps that use Shorebird.
20
20
 
21
- In your Flutter app's `ios` and/or `android` directories, initialize Fastlane
21
+ In your Flutter app's `ios`, `android` and/or `macos` directories, initialize Fastlane
22
22
  and add this plugin using `bundle exec fastlane add_plugin shorebird`.
23
23
 
24
24
  Then, update your `Fastfile` to include the following:
@@ -31,6 +31,20 @@ end
31
31
 
32
32
  This will create a new release on Shorebird for the iOS platform.
33
33
 
34
+ `shorebird_release` and `shorebird_patch` accept `ios`, `android` and `macos`
35
+ as the `platform`. An iOS release writes the path of its `.ipa` to
36
+ `lane_context[SharedValues::IPA_OUTPUT_PATH]`, and a macOS release writes the
37
+ path of its `.app` to `lane_context[SharedValues::SHOREBIRD_MACOS_APP_OUTPUT_PATH]`:
38
+
39
+ ```ruby
40
+ platform :mac do
41
+ lane :release do
42
+ shorebird_release(platform: "macos")
43
+ app_path = lane_context[SharedValues::SHOREBIRD_MACOS_APP_OUTPUT_PATH]
44
+ end
45
+ end
46
+ ```
47
+
34
48
  See https://docs.shorebird.dev/guides/fastlane for more information.
35
49
 
36
50
  ## Run tests for this plugin
@@ -24,7 +24,7 @@ module Fastlane
24
24
  [
25
25
  FastlaneCore::ConfigItem.new(
26
26
  key: :platform,
27
- description: "Which platform to patch (ios,android)",
27
+ description: "Which platform to patch (ios,android,macos)",
28
28
  optional: false,
29
29
  type: String
30
30
  ),
@@ -2,10 +2,15 @@ require 'fastlane/action'
2
2
  require_relative '../helper/shorebird_helper'
3
3
  require 'gym'
4
4
  require 'plist'
5
+ require 'shellwords'
5
6
  require 'tempfile'
6
7
 
7
8
  module Fastlane
8
9
  module Actions
10
+ module SharedValues
11
+ SHOREBIRD_MACOS_APP_OUTPUT_PATH = :SHOREBIRD_MACOS_APP_OUTPUT_PATH
12
+ end
13
+
9
14
  class ShorebirdReleaseAction < Action
10
15
  def self.run(params)
11
16
  platform = params[:platform]
@@ -26,18 +31,79 @@ module Fastlane
26
31
  command = "shorebird release #{platform} #{params[:args]}".strip
27
32
  Fastlane::Actions.sh(command)
28
33
 
29
- if platform == "ios"
34
+ write_output_path(params)
35
+ end
36
+
37
+ def self.write_output_path(params)
38
+ case params[:platform]
39
+ when "ios"
30
40
  lane_context[SharedValues::IPA_OUTPUT_PATH] = most_recent_ipa_file
41
+ when "macos"
42
+ lane_context[SharedValues::SHOREBIRD_MACOS_APP_OUTPUT_PATH] = most_recent_macos_app(flavor_from_args(params[:args]))
31
43
  end
32
44
  end
33
45
 
34
46
  def self.most_recent_ipa_file
35
- Dir.glob('../build/ios/ipa/*.ipa')
36
- .sort_by! { |f| File.stat(f).ctime }
47
+ most_recent_file(ipa_path_pattern)
48
+ end
49
+
50
+ def self.most_recent_macos_app(flavor)
51
+ most_recent_file(macos_app_path_pattern(flavor))
52
+ end
53
+
54
+ # The flavor the CLI builds, read as its ArgResults.findOption does: a
55
+ # --flavor (as --flavor=<x> or --flavor <x>) before a bare -- separator
56
+ # wins, the last one if repeated, as for any parsed option. Otherwise the
57
+ # first --flavor after the separator is used.
58
+ def self.flavor_from_args(args)
59
+ tokens = Shellwords.split(args.to_s)
60
+ separator = tokens.index('--') || tokens.length
61
+ flavor_values(tokens[0...separator]).last || flavor_values(tokens[(separator + 1)..] || []).first
62
+ end
63
+
64
+ def self.flavor_values(tokens)
65
+ tokens.each_with_index.map do |token, i|
66
+ if token == '--flavor'
67
+ tokens[i + 1]
68
+ elsif token.start_with?('--flavor=')
69
+ token.delete_prefix('--flavor=')
70
+ end
71
+ end.compact
72
+ end
73
+
74
+ def self.most_recent_file(pattern)
75
+ Dir.glob(pattern)
76
+ .sort_by! { |f| File.stat(f).mtime }
37
77
  .reverse!
38
78
  .first
39
79
  end
40
80
 
81
+ # Traverses up the directory tree until it finds a pubspec.yaml file.
82
+ # If no parent directory contains a pubspec.yaml file, we assume we are
83
+ # not in a Flutter project and raise an error.
84
+ def self.project_root
85
+ current_dir = Dir.pwd
86
+ current_dir = File.expand_path('..', current_dir) until File.exist?(File.join(current_dir, 'pubspec.yaml')) || (current_dir == '/')
87
+ # If we've reached the root directory, we've failed to find a pubspec.yaml file.
88
+ if current_dir == '/'
89
+ raise "Could not find pubspec.yaml in the directory tree"
90
+ end
91
+
92
+ current_dir
93
+ end
94
+
95
+ # .ipa path relative to the project root
96
+ def self.ipa_path_pattern
97
+ File.join(project_root, 'build/ios/ipa', '*.ipa')
98
+ end
99
+
100
+ # .app path relative to the project root. Flavored builds are written to
101
+ # Release-<flavor> instead of Release.
102
+ def self.macos_app_path_pattern(flavor)
103
+ build_dir = flavor ? "Release-#{flavor}" : 'Release'
104
+ File.join(project_root, 'build/macos/Build/Products', build_dir, '*.app')
105
+ end
106
+
41
107
  def self.export_options_plist_in_args?(params)
42
108
  params[:args].include?("--export-options-plist")
43
109
  end
@@ -58,7 +124,7 @@ module Fastlane
58
124
  [
59
125
  FastlaneCore::ConfigItem.new(
60
126
  key: :platform,
61
- description: "Which platform to release to (ios,android)",
127
+ description: "Which platform to release to (ios,android,macos)",
62
128
  optional: false,
63
129
  type: String
64
130
  ),
@@ -80,6 +146,13 @@ module Fastlane
80
146
  ]
81
147
  end
82
148
 
149
+ def self.output
150
+ [
151
+ ['IPA_OUTPUT_PATH', 'The path to the .ipa created by an ios release'],
152
+ ['SHOREBIRD_MACOS_APP_OUTPUT_PATH', 'The path to the .app created by a macos release']
153
+ ]
154
+ end
155
+
83
156
  def self.is_supported?(platform)
84
157
  Helper::ShorebirdHelper.supported_platforms.include?(platform)
85
158
  end
@@ -13,7 +13,7 @@ module Fastlane
13
13
  export_options_hash = {}
14
14
  if export_options.kind_of?(Hash)
15
15
  export_options_hash = export_options
16
- export_options_hash[:method] = "app-store"
16
+ export_options_hash[:method] ||= "app-store"
17
17
  if provisioning_profile_mapping
18
18
  # If match has provided provisioning profiles, put them in the export options plist
19
19
  export_options_hash[:provisioningProfiles] = provisioning_profile_mapping
@@ -17,7 +17,7 @@ module Fastlane
17
17
  end
18
18
 
19
19
  def self.supported_platforms
20
- [:ios, :android]
20
+ [:ios, :android, :mac]
21
21
  end
22
22
  end
23
23
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Shorebird
3
- VERSION = "0.3.0"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-shorebird
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shorebird
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-11-09 00:00:00.000000000 Z
11
12
  dependencies: []
13
+ description:
12
14
  email: contact@shorebird.dev
13
15
  executables: []
14
16
  extensions: []
@@ -27,6 +29,7 @@ licenses:
27
29
  - MIT
28
30
  metadata:
29
31
  rubygems_mfa_required: 'true'
32
+ post_install_message:
30
33
  rdoc_options: []
31
34
  require_paths:
32
35
  - lib
@@ -41,7 +44,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
41
44
  - !ruby/object:Gem::Version
42
45
  version: '0'
43
46
  requirements: []
44
- rubygems_version: 3.6.9
47
+ rubygems_version: 3.5.22
48
+ signing_key:
45
49
  specification_version: 4
46
50
  summary: Create Shorebird releases and patches
47
51
  test_files: []