fastlane-plugin-emerge 0.10.3 → 0.10.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1161add2ba3f228582fda18fc0b5168ccfd3e81272774546d490eaf17a508659
4
- data.tar.gz: eef51649fc4f5ce59c3df1992b0164af8bd80d3d3ea85f2babb146f9d25aead3
3
+ metadata.gz: 5af3be7b1a251da05592383703e74d646beeffe6ed7bc50cc4e139f662332d3c
4
+ data.tar.gz: ae2179ef90e77a6916a75f0a0265d94bfd2aec7205d90ad4187d891266aba756
5
5
  SHA512:
6
- metadata.gz: 896b6b3360371b91cb02ed7d6a3d978afd0fff505ed0c53a8eb5afc3ba725a64c3e209ffeef42e24d046f7d343efbbd309a209abf14fd48cc0ccbb13ebdfa1a5
7
- data.tar.gz: 81bcd3b3df28794e127ad26c4002c2da9e2c62cc687f48747bbdae6126ab05ddf9def2743ac85df85c122a22945c5961e256a1ee4b4b2d01cfd0c227669e63a8
6
+ metadata.gz: 4feffe8f6cc285b4d634f8140b44432194308edf6a7c46e2e62fed0674527239a30ce814bd035763444b8fa3c3e81950ab08d700c01486762a61e0cb1c693509
7
+ data.tar.gz: 943719d58ae8a684fd3bfd31b6c74c693ffc28b18d7be7945f0ed9e15d68fe39bd127545ca6090fde9678dcd24bfeeeb5382744eda6a596a354e4a2025689237
data/README.md CHANGED
@@ -22,14 +22,17 @@ To get started, first obtain an [API token](https://docs.emergetools.com/docs/up
22
22
 
23
23
  ```ruby
24
24
  platform :ios do
25
- lane :app_size do
26
- # Make a signed release build via gym() and other tools
27
- # and then call our `emerge()` action to upload the artifact to our API
28
- emerge()
25
+ lane :emerge_upload do
26
+ # Tip: group builds in our dashboard via the `tag` parameter
27
+ emerge(tag: 'pr_build')
29
28
  end
30
29
  end
31
30
  ```
32
31
 
32
+ 1. Produce a build using `gym()`, `run_tests()`, or other Fastlane actions
33
+ 2. When you are ready to upload to Emerge, simply call the `emerge()` action
34
+ - a. We will automatically detect the most recently built app to upload, or you can manually pass in a `file_path` parameter
35
+
33
36
  For a full list of available parameters run `fastlane action emerge`.
34
37
 
35
38
  ### Snapshot Testing
@@ -13,11 +13,18 @@ module Fastlane
13
13
  class EmergeAction < Action
14
14
  def self.run(params)
15
15
  api_token = params[:api_token]
16
- file_path = params[:file_path] || lane_context[SharedValues::XCODEBUILD_ARCHIVE]
17
16
 
18
- if file_path.nil?
19
- file_path = Dir.glob("#{lane_context[SharedValues::SCAN_DERIVED_DATA_PATH]}/Build/Products/Debug-iphonesimulator/*.app").first
20
- end
17
+ file_path = if params[:file_path]
18
+ UI.message("Using input file_path: #{file_path}")
19
+ params[:file_path]
20
+ elsif lane_context[SharedValues::XCODEBUILD_ARCHIVE]
21
+ UI.message("Using XCODEBUILD_ARCHIVE path")
22
+ lane_context[SharedValues::XCODEBUILD_ARCHIVE]
23
+ else
24
+ UI.message("Falling back to searching SCAN_DERIVED_DATA_PATH")
25
+ Dir.glob("#{lane_context[SharedValues::SCAN_DERIVED_DATA_PATH]}/Build/Products/Debug-iphonesimulator/*.app").first
26
+ end
27
+
21
28
  git_params = Helper::EmergeHelper.make_git_params
22
29
  pr_number = params[:pr_number] || git_params.pr_number
23
30
  branch = params[:branch] || git_params.branch
@@ -32,6 +39,8 @@ module Fastlane
32
39
  if file_path.nil? || !File.exist?(file_path)
33
40
  UI.error("Invalid input file")
34
41
  return false
42
+ else
43
+ UI.message("Using file_path: #{file_path}")
35
44
  end
36
45
  extension = File.extname(file_path)
37
46
 
@@ -8,7 +8,36 @@ module Fastlane
8
8
  shell_command = "git rev-parse --abbrev-ref HEAD"
9
9
  UI.command(shell_command)
10
10
  stdout, _, status = Open3.capture3(shell_command)
11
- stdout.strip if status.success?
11
+ unless status.success?
12
+ UI.error("Failed to get the current branch name")
13
+ return nil
14
+ end
15
+
16
+ branch_name = stdout.strip
17
+ if branch_name == "HEAD"
18
+ # We're in a detached HEAD state
19
+ # Find all branches that contains the current HEAD commit
20
+ #
21
+ # Example output:
22
+ # * (HEAD detached at dec13a5)
23
+ # telkins/detached-test
24
+ # remotes/origin/telkins/detached-test
25
+ #
26
+ # So far I've seen this output be fairly stable
27
+ # If the input is invalid for whatever reason, sed/awk will return an empty string
28
+ shell_command = "git branch -a --contains HEAD | sed -n 2p | awk '{ printf $1 }'"
29
+ UI.command(shell_command)
30
+ head_stdout, _, head_status = Open3.capture3(shell_command)
31
+
32
+ unless head_status.success?
33
+ UI.error("Failed to get the current branch name for detached HEAD")
34
+ return nil
35
+ end
36
+
37
+ branch_name = head_stdout.strip
38
+ end
39
+
40
+ branch_name == "HEAD" ? nil : branch_name
12
41
  end
13
42
 
14
43
  def self.sha
@@ -19,7 +48,11 @@ module Fastlane
19
48
  end
20
49
 
21
50
  def self.base_sha
22
- shell_command = "git merge-base #{remote_head_branch} #{branch}"
51
+ current_branch = branch
52
+ remote_head = remote_head_branch
53
+ return nil if current_branch.nil? || remote_head.nil?
54
+
55
+ shell_command = "git merge-base #{remote_head} #{current_branch}"
23
56
  UI.command(shell_command)
24
57
  stdout, _, status = Open3.capture3(shell_command)
25
58
  return nil if stdout.strip.empty? || !status.success?
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Emerge
3
- VERSION = "0.10.3"
3
+ VERSION = "0.10.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-emerge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emerge Tools, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-05 00:00:00.000000000 Z
11
+ date: 2024-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday