From 1bccaa4d5c07dbcf349dc78983be7378d637b62e Mon Sep 17 00:00:00 2001 From: Nikita Kuznetsov Date: Sun, 8 Dec 2024 13:10:25 +0100 Subject: [PATCH] deliver => pilot UI.message("Changelog: #{changelog}") Add Comments Remove line App file + fix change log Update variable profile_name Revert "profile_name" This reverts commit 245295d1bb7b25c2f2e972d9599d9a13302016a1. Update change log Add version number master => main Add json plugin Update package path Update output variable Update changelog_from_git_commits remove any options Update change-log Update changelog --- .github/workflows/ipad-build.yaml | 20 +++++++++ apps/tablet/Gemfile | 4 +- apps/tablet/Gemfile.lock | 2 + apps/tablet/fastlane/Appfile | 2 + apps/tablet/fastlane/Fastfile | 70 +++++++++++++++++++------------ apps/tablet/fastlane/Pluginfile | 5 +++ apps/tablet/fastlane/README.md | 40 ++++++++++++++++++ 7 files changed, 115 insertions(+), 28 deletions(-) create mode 100644 apps/tablet/fastlane/Appfile create mode 100644 apps/tablet/fastlane/Pluginfile create mode 100644 apps/tablet/fastlane/README.md diff --git a/.github/workflows/ipad-build.yaml b/.github/workflows/ipad-build.yaml index 71a05a7d8..5b06bfe45 100644 --- a/.github/workflows/ipad-build.yaml +++ b/.github/workflows/ipad-build.yaml @@ -37,6 +37,8 @@ jobs: steps: - name: Checkout to git repository uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up Node uses: actions/setup-node@v4 @@ -120,3 +122,21 @@ jobs: with: name: gum-logs path: /Users/runner/Library/Logs/gym/*.log + + - name: Summary + run: | + echo '### Successful iPad build 🚀🚀🚀' >> $GITHUB_STEP_SUMMARY + echo 'Well done!' >> $GITHUB_STEP_SUMMARY + echo 'The app with build version: ${{ env.VERSION_CODE }}(${{ env.BUILD_CODE }})' >> $GITHUB_STEP_SUMMARY + echo 'Uploaded to TestFlight' >> $GITHUB_STEP_SUMMARY + + - name: Comment PR + uses: thollander/actions-comment-pull-request@v3 + if: github.event_name == 'pull_request' + with: + message: | + ### Successful iPad build 🚀🚀🚀 + Well done! + The app with build version: ${{ env.VERSION_CODE }}(${{ env.BUILD_CODE }}) + Uploaded to TestFlight + comment-tag: ipad_build diff --git a/apps/tablet/Gemfile b/apps/tablet/Gemfile index 8bdd597b6..1f39b80e2 100644 --- a/apps/tablet/Gemfile +++ b/apps/tablet/Gemfile @@ -2,4 +2,6 @@ source 'https://rubygems.org' # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version ruby ">= 3.3.0" gem 'cocoapods', '~> 1.13' -gem "fastlane" \ No newline at end of file +gem "fastlane" +plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') +eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/apps/tablet/Gemfile.lock b/apps/tablet/Gemfile.lock index 6e4f40774..c73c45a14 100644 --- a/apps/tablet/Gemfile.lock +++ b/apps/tablet/Gemfile.lock @@ -170,6 +170,7 @@ GEM xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) + fastlane-plugin-json (1.1.7) fastlane-sirp (1.0.0) sysrandom (~> 1.0) ffi (1.17.0) @@ -313,6 +314,7 @@ PLATFORMS DEPENDENCIES cocoapods (~> 1.13) fastlane + fastlane-plugin-json RUBY VERSION ruby 3.3.6p108 diff --git a/apps/tablet/fastlane/Appfile b/apps/tablet/fastlane/Appfile new file mode 100644 index 000000000..d03e535b7 --- /dev/null +++ b/apps/tablet/fastlane/Appfile @@ -0,0 +1,2 @@ +app_identifier(ENV["BUNDLE_IDENTIFIER"]) +team_id(ENV["APP_STORE_CONNECT_TEAM_ID"]) \ No newline at end of file diff --git a/apps/tablet/fastlane/Fastfile b/apps/tablet/fastlane/Fastfile index fcdf2b0ae..8c47a7993 100644 --- a/apps/tablet/fastlane/Fastfile +++ b/apps/tablet/fastlane/Fastfile @@ -1,14 +1,18 @@ + platform :ios do + xcodeproj = "./ios/App/App.xcodeproj" + workspace = "./ios/App/App.xcworkspace" + desc 'Export ipa and submit to TestFlight' lane :beta do keychain_info = { keychain_name: "ios-build-#{Time.now.to_i}.keychain", keychain_password: SecureRandom.uuid } - + + begin setup_signing(keychain_info) load_asc_api_key bump_build_number build_app_with_signing(keychain_info) - create_changelog submit_to_testflight ensure cleanup_keychain(keychain_info) @@ -41,26 +45,34 @@ platform :ios do end lane :bump_build_number do + package = read_json(json_path: "./package.json") + increment_version_number( + xcodeproj: xcodeproj, + version_number: package[:version] + ) + api_key = lane_context[SharedValues::APP_STORE_CONNECT_API_KEY] + app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) - xcodeproj = "./ios/App/App.xcodeproj"; current_version = get_version_number(xcodeproj: xcodeproj) latest_build_number = app_store_build_number( - initial_build_number: 5, + initial_build_number: 0, api_key: api_key, - app_identifier: ENV['BUNDLE_IDENTIFIER'], + app_identifier: app_identifier, + version: package[:version], live: false ) build_number = latest_build_number + 1 - + increment_build_number( xcodeproj: xcodeproj, build_number: build_number ) UI.message("Bumped build number to #{build_number}") - sh("echo VERSION_CODE=#{build_number} >> $GITHUB_ENV") + sh("echo VERSION_CODE=#{package[:version]} >> $GITHUB_ENV") + sh("echo BUILD_CODE=#{build_number} >> $GITHUB_ENV") end private_lane :import_cert do |options| @@ -92,18 +104,21 @@ platform :ios do end private_lane :update_project_settings do + app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) + team_id = CredentialsManager::AppfileConfig.try_fetch_value(:team_id) + update_code_signing_settings( - path: "./ios/App/App.xcodeproj", + path: xcodeproj, use_automatic_signing: false, code_sign_identity: "iPhone Distribution", - team_id: ENV['APP_STORE_CONNECT_TEAM_ID'], - bundle_identifier: ENV['BUNDLE_IDENTIFIER'], + team_id: team_id, + bundle_identifier: app_identifier, profile_name: ENV['APPLE_PROFILE_NAME'], ) update_project_team( - path: "./ios/App/App.xcodeproj", - teamid: ENV['APP_STORE_CONNECT_TEAM_ID'] + path: xcodeproj, + teamid: team_id ) end @@ -113,15 +128,16 @@ platform :ios do password: options[:keychain_password], set_default: false ) + app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) build_app( - workspace: "./ios/App/App.xcworkspace", + workspace: workspace, scheme: "App", configuration: "Release", export_method: "app-store", - output_name: "App.ipa", + output_name: "TonkeeperPro.ipa", export_options: { provisioningProfiles: { - ENV['BUNDLE_IDENTIFIER'] => ENV['APPLE_PROFILE_NAME'] + app_identifier => ENV['APPLE_PROFILE_NAME'] } }, xcargs: "-verbose", @@ -130,22 +146,22 @@ platform :ios do ) end - private_lane :create_changelog do - release_notes = "./metadata/default/release_notes.txt" - changes = changelog_from_git_commits(commits_count: 10, merge_commit_filtering: "exclude_merges") - File.write(release_notes, changes) - end - private_lane :submit_to_testflight do api_key = lane_context[SharedValues::APP_STORE_CONNECT_API_KEY] + ipa = lane_context[SharedValues::IPA_OUTPUT_PATH] + changelog = changelog_from_git_commits( + merge_commit_filtering: "exclude_merges", + between: ["origin/main", "HEAD"] + ) - deliver( + pilot( api_key: api_key, - skip_screenshots: false, - skip_metadata: false, - skip_app_version_update: true, - force: true, # skips verification of HTML preview file (since this will be run from a CI machine) - run_precheck_before_submit: false # not supported through ASC API yet + ipa: ipa, + changelog: changelog, + skip_waiting_for_build_processing: true, + skip_submission: true, + distribute_external: false, + notify_external_testers: false ) end end \ No newline at end of file diff --git a/apps/tablet/fastlane/Pluginfile b/apps/tablet/fastlane/Pluginfile new file mode 100644 index 000000000..bffd8eb24 --- /dev/null +++ b/apps/tablet/fastlane/Pluginfile @@ -0,0 +1,5 @@ +# Autogenerated by fastlane +# +# Ensure this file is checked in to source control! + +gem 'fastlane-plugin-json' diff --git a/apps/tablet/fastlane/README.md b/apps/tablet/fastlane/README.md new file mode 100644 index 000000000..233c5febd --- /dev/null +++ b/apps/tablet/fastlane/README.md @@ -0,0 +1,40 @@ +fastlane documentation +---- + +# Installation + +Make sure you have the latest version of the Xcode command line tools installed: + +```sh +xcode-select --install +``` + +For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane) + +# Available Actions + +## iOS + +### ios beta + +```sh +[bundle exec] fastlane ios beta +``` + +Export ipa and submit to TestFlight + +### ios bump_build_number + +```sh +[bundle exec] fastlane ios bump_build_number +``` + + + +---- + +This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. + +More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools). + +The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).