diff --git a/.env.sample b/.env.sample new file mode 100644 index 00000000..36d8ff9c --- /dev/null +++ b/.env.sample @@ -0,0 +1,3 @@ +# Credentials used in tests +ALGOLIA_APPLICATION_ID_1= +ALGOLIA_ADMIN_KEY_1= diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 16aba128..b7662a44 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -93,7 +93,23 @@ These changes will be then pushed in a pull request, ready to be merged. #### CocoaPods specifics -While both Swift Package Manager and Carthage rely on GitHub and git tags to retrieve the library, CocoaPods has its own repository. If for any reason the deployment fails at the `pod_push` step, InstantSearch iOS can be published to CocoaPods manually from an authorized user. +While both Swift Package Manager and Carthage rely on GitHub and git tags to retrieve the library, CocoaPods has its own repository. + +[Since Xcode 14.3](https://github.com/CocoaPods/CocoaPods/issues/11839), the deployment fails at the `pod_push` step, requiring the library to be manually published to the CocoaPods repository. The Fastlane deploy does not include this step anymore. + +InstantSearch iOS should be published to CocoaPods manually from an authorized user's local environment. Xcode 14.2 cannot be used to build as it's incompatible with macOS Sonoma and up, but it's possible to [copy some of its files](https://github.com/CocoaPods/CocoaPods/issues/12033#issuecomment-2172608443) that are mistakenly required by CocoaPods for Podfile validation: + +```bash +# Install Xcode 14.2 (here, using xcodes CLI) +xcodes install 14.2 + +# Copy required files +sudo cp /Applications/Xcode-14.2.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc +``` + +In the meantime, [merge the deploy PR](https://github.com/algolia/instantsearch-ios/pulls) generated by the pipeline and pull it into your local repository. + +Finally, register or authenticate with CocoaPods, and publish the new version manually. **Registering a user** with CocoaPods: diff --git a/fastlane/Fastfile b/fastlane/Fastfile index dec3c205..d5275820 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -58,7 +58,7 @@ lane :deploy do |options| base_branch = options[:branch] || "master" # ensure branch and cleanliness locally but not on Bitrise. - if !ENV['GITHUB_ACTION'] + if !ENV['GITHUB_ACTION'] ensure_git_branch( branch: base_branch ) @@ -114,13 +114,15 @@ lane :deploy do |options| sh("git tag -d #{release_type}; git push --delete origin #{release_type}") end - pod_push( - path: podspec_path, - allow_warnings: true - ) + # Disabled, manual CocoaPods release required. + # See CONTRIBUTING.md for more information. + # pod_push( + # path: podspec_path, + # allow_warnings: true + # ) end -lane :deployBeta do |options| +lane :deployBeta do |options| branch = options[:branch] || "master" pod_lib_lint( @@ -149,10 +151,12 @@ lane :deployBeta do |options| ) push_to_git_remote(remote: "origin") - pod_push( - path: "InstantSearch.podspec", - allow_warnings: true - ) + # Disabled, manual CocoaPods release required. + # See CONTRIBUTING.md for more information. + # pod_push( + # path: "InstantSearch.podspec", + # allow_warnings: true + # ) end @@ -164,14 +168,14 @@ def prepare_git(branch) # ensure_git_branch(branch:branch) masterHash = sh("git rev-parse origin/#{branch}") headHash = sh("git rev-parse HEAD") - - if masterHash != headHash + + if masterHash != headHash raise "Error: Master and Head Hashes do not match, meaning that we are probably not on Master and therefore can't deploy" end # checkout master to be able to push tag there. sh("git checkout #{branch}") - + # We already pull in bitrise before doing anything, so no need for this step anymore. # git_pull end @@ -183,7 +187,7 @@ def prepare_api_keys() if api_key xcargs << %Q[ALGOLIA_API_KEY="#{api_key}"] end - + api_id = ENV["ALGOLIA_APPLICATION_ID"] if api_id xcargs << %Q[ALGOLIA_APPLICATION_ID="#{api_id}"] @@ -193,7 +197,7 @@ def prepare_api_keys() if places_api_id xcargs << %Q[PLACES_APPLICATION_ID="#{places_api_id}"] end - + places_api_key = ENV["PLACES_API_KEY"] if places_api_key xcargs << %Q[PLACES_API_KEY="#{places_api_key}"]