Skip to content

Commit

Permalink
Fix pod install of sample when updating phc (#954)
Browse files Browse the repository at this point in the history
`update_sample_podfile_lock_with_retry` was failing with missing
`sample_path`
  • Loading branch information
vegaro authored Mar 26, 2024
1 parent 56dae82 commit 72eab78
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
8 changes: 5 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ jobs:

update-hybrid-common-versions:
description: "Creates a PR updating purchases-hybrid-common to latest release"
docker:
- image: cimg/ruby:3.3.0-node
executor:
name: rn/macos
resource_class: macos.x86.medium.gen2
xcode_version: 14.3.1
steps:
- checkout
- revenuecat/install-gem-unix-dependencies:
- revenuecat/install-gem-mac-dependencies:
cache-version: v1
- revenuecat/trust-github-key
- revenuecat/setup-git-credentials
Expand Down
15 changes: 7 additions & 8 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@ lane :update_hybrid_common do |options|
sh('yarn install --no-immutable')
commit_current_changes(commit_message: 'Update yarn.lock')

# Pushing now in case updating podfile fails and needs to retry
push_to_git_remote(set_upstream: true)

# This will update both PurchasesHybridCommonUI and PurchasesHybridCommon
update_sample_podfile_lock_with_retry('PurchasesHybridCommonUI')
update_sample_podfile_lock_with_retry(pod_name: 'PurchasesHybridCommonUI')

push_to_git_remote(set_upstream: true)
end
Expand Down Expand Up @@ -248,12 +251,6 @@ def get_phc_version
end
end

def parse_pod_version
Dir.chdir(get_root_folder) do
return sh("cat #{sample_path}/ios/Podfile.lock | grep \' Purchases (=\' | awk \'{print($4)}\' | sed \"s/)//g\"").strip
end
end

def get_root_folder
return File.expand_path('../../', __FILE__)
end
Expand All @@ -268,7 +265,9 @@ def check_no_git_tag_exists(version_number)
end
end

def update_sample_podfile_lock_with_retry(pod_name)
private_lane :update_sample_podfile_lock_with_retry do |options|
pod_name = options[:pod_name]

retry_attempts = 4 # Total of 4 retries, with the first attempt considered, equals 5 attempts over 20 minutes
Dir.chdir(File.expand_path("#{sample_path}/ios", get_root_folder)) do
begin
Expand Down

0 comments on commit 72eab78

Please sign in to comment.