diff --git a/.github/workflows/release-alpha.yml b/.github/workflows/release-alpha.yml index cfe3e87af..baf54130b 100644 --- a/.github/workflows/release-alpha.yml +++ b/.github/workflows/release-alpha.yml @@ -36,7 +36,7 @@ jobs: # Common setup - name: Brew bundle run: - brew update && brew bundle && brew upgrade swiftformat + brew bundle - name: SwiftFormat run: @@ -46,13 +46,6 @@ jobs: run: | bundle config path vendor/bundle bundle install --jobs 4 --retry 3 - - - uses: actions/setup-python@v3 - with: - python-version: '3.x' - cache: 'pip' - - - run: pip install -r requirements.txt # Import alpha release private signing certificate - name: Import signing certificate @@ -85,7 +78,5 @@ jobs: ![QR code](${{ env.DIAWI_QR_CODE_LINK }}) If you can't scan the QR code you can install the build via this link: ${{ env.DIAWI_FILE_LINK }} - # Enables to identify and update existing Ad-hoc release message on new commit in the PR - identifier: "GITHUB_COMMENT_ADHOC_RELEASE" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index 8258a48b5..1d2c13d44 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -2845,7 +2845,6 @@ 62E1B7866DF0ED442C39A83B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - APP_GROUP_IDENTIFIER = group.io.element; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = ElementX/SupportingFiles/ElementX.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; @@ -2857,7 +2856,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.4; - PRODUCT_BUNDLE_IDENTIFIER = io.element.elementx; + PRODUCT_BUNDLE_IDENTIFIER = "$(BASE_BUNDLE_IDENTIFIER)"; PRODUCT_NAME = ElementX; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = "ElementX/SupportingFiles/ElementX-Bridging-Header.h"; @@ -2869,7 +2868,6 @@ 6897D5BC19A2EA6ABD57DE7E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - APP_GROUP_IDENTIFIER = group.io.element; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = ElementX/SupportingFiles/ElementX.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; @@ -2881,7 +2879,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.4; - PRODUCT_BUNDLE_IDENTIFIER = io.element.elementx; + PRODUCT_BUNDLE_IDENTIFIER = "$(BASE_BUNDLE_IDENTIFIER)"; PRODUCT_NAME = ElementX; SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = "ElementX/SupportingFiles/ElementX-Bridging-Header.h"; @@ -2900,7 +2898,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = io.element.elementx.unit.tests; + PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.unit.tests"; PRODUCT_NAME = UnitTests; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -2912,6 +2910,9 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + APP_GROUP_IDENTIFIER = "group.$(BASE_APP_GROUP_IDENTIFIER)"; + BASE_APP_GROUP_IDENTIFIER = io.element; + BASE_BUNDLE_IDENTIFIER = io.element.elementx; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -2971,6 +2972,9 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + APP_GROUP_IDENTIFIER = "group.$(BASE_APP_GROUP_IDENTIFIER)"; + BASE_APP_GROUP_IDENTIFIER = io.element; + BASE_BUNDLE_IDENTIFIER = io.element.elementx; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -3043,7 +3047,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = io.element.elementx.unit.tests; + PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.unit.tests"; PRODUCT_NAME = UnitTests; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -3061,7 +3065,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = io.element.elementx.ui.tests; + PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.ui.tests"; PRODUCT_NAME = UITests; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -3079,7 +3083,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = io.element.elementx.ui.tests; + PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.ui.tests"; PRODUCT_NAME = UITests; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -3097,7 +3101,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = io.element.elementx.integration.tests; + PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.integration.tests"; PRODUCT_NAME = IntegrationTests; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -3115,7 +3119,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = io.element.elementx.integration.tests; + PRODUCT_BUNDLE_IDENTIFIER = "${BASE_BUNDLE_IDENTIFIER}.integration.tests"; PRODUCT_NAME = IntegrationTests; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; diff --git a/ElementX/SupportingFiles/ElementX.entitlements b/ElementX/SupportingFiles/ElementX.entitlements index 4ead86aa7..81b37208f 100644 --- a/ElementX/SupportingFiles/ElementX.entitlements +++ b/ElementX/SupportingFiles/ElementX.entitlements @@ -10,9 +10,5 @@ com.apple.security.network.client - keychain-access-groups - - $(AppIdentifierPrefix)io.element.elementx - diff --git a/ElementX/SupportingFiles/Info.plist b/ElementX/SupportingFiles/Info.plist index 2240a5e89..9aadd8a1a 100644 --- a/ElementX/SupportingFiles/Info.plist +++ b/ElementX/SupportingFiles/Info.plist @@ -20,6 +20,8 @@ $(MARKETING_VERSION) CFBundleVersion $(CURRENT_PROJECT_VERSION) + ITSAppUsesNonExemptEncryption + UILaunchStoryboardName LaunchScreen UISupportedInterfaceOrientations diff --git a/ElementX/SupportingFiles/target.yml b/ElementX/SupportingFiles/target.yml index 33b125341..2d7ea4109 100644 --- a/ElementX/SupportingFiles/target.yml +++ b/ElementX/SupportingFiles/target.yml @@ -46,12 +46,12 @@ targets: UIInterfaceOrientationLandscapeRight ] appGroupIdentifier: $(APP_GROUP_IDENTIFIER) + ITSAppUsesNonExemptEncryption: false settings: base: PRODUCT_NAME: ElementX - PRODUCT_BUNDLE_IDENTIFIER: io.element.elementx - APP_GROUP_IDENTIFIER: group.io.element + PRODUCT_BUNDLE_IDENTIFIER: $(BASE_BUNDLE_IDENTIFIER) MARKETING_VERSION: 1.0.4 CURRENT_PROJECT_VERSION: 1 DEVELOPMENT_TEAM: 7J4U792NQT diff --git a/Gemfile.lock b/Gemfile.lock index 49c60fa59..76cc66455 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,19 +3,18 @@ GEM specs: CFPropertyList (3.0.5) rexml - activesupport (7.0.3.1) + activesupport (7.0.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.2.0) - aws-partitions (1.610.0) - aws-sdk-core (3.131.3) + aws-partitions (1.647.0) + aws-sdk-core (3.161.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.525.0) aws-sigv4 (~> 1.1) @@ -27,7 +26,7 @@ GEM aws-sdk-core (~> 3, >= 3.127.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) - aws-sigv4 (1.5.1) + aws-sigv4 (1.5.2) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) claide (1.1.0) @@ -42,10 +41,10 @@ GEM rake (>= 12.0.0, < 14.0.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) - dotenv (2.7.6) + dotenv (2.8.1) emoji_regex (3.2.3) - excon (0.92.4) - faraday (1.10.0) + excon (0.93.0) + faraday (1.10.2) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -74,7 +73,7 @@ GEM faraday_middleware (1.2.0) faraday (~> 1.0) fastimage (2.2.6) - fastlane (2.208.0) + fastlane (2.210.1) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -116,13 +115,14 @@ GEM fastlane-plugin-brew (0.1.1) fastlane-plugin-diawi (2.1.0) rest-client (>= 2.0.0) - fastlane-plugin-sentry (1.12.2) + fastlane-plugin-sentry (1.14.0) + os (~> 1.1, >= 1.1.4) fastlane-plugin-xcodegen (1.1.0) fastlane-plugin-brew (~> 0.1.1) gh_inspector (1.1.3) - google-apis-androidpublisher_v3 (0.25.0) - google-apis-core (>= 0.7, < 2.a) - google-apis-core (0.7.0) + google-apis-androidpublisher_v3 (0.29.0) + google-apis-core (>= 0.9.0, < 2.a) + google-apis-core (0.9.1) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) @@ -131,27 +131,27 @@ GEM retriable (>= 2.0, < 4.a) rexml webrick - google-apis-iamcredentials_v1 (0.13.0) - google-apis-core (>= 0.7, < 2.a) - google-apis-playcustomapp_v1 (0.10.0) - google-apis-core (>= 0.7, < 2.a) - google-apis-storage_v1 (0.18.0) - google-apis-core (>= 0.7, < 2.a) + google-apis-iamcredentials_v1 (0.15.0) + google-apis-core (>= 0.9.0, < 2.a) + google-apis-playcustomapp_v1 (0.11.0) + google-apis-core (>= 0.9.0, < 2.a) + google-apis-storage_v1 (0.19.0) + google-apis-core (>= 0.9.0, < 2.a) google-cloud-core (1.6.0) google-cloud-env (~> 1.0) google-cloud-errors (~> 1.0) google-cloud-env (1.6.0) faraday (>= 0.17.3, < 3.0) - google-cloud-errors (1.2.0) - google-cloud-storage (1.37.0) + google-cloud-errors (1.3.0) + google-cloud-storage (1.43.0) addressable (~> 2.8) digest-crc (~> 0.4) google-apis-iamcredentials_v1 (~> 0.1) - google-apis-storage_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.19.0) google-cloud-core (~> 1.6) googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - googleauth (1.2.0) + googleauth (1.3.0) faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) memoist (~> 0.16) @@ -167,7 +167,7 @@ GEM concurrent-ruby (~> 1.0) jmespath (1.6.1) json (2.6.2) - jwt (2.4.1) + jwt (2.5.0) memoist (0.16.2) mime-types (3.4.1) mime-types-data (~> 3.2015) @@ -175,19 +175,19 @@ GEM mini_magick (4.11.0) mini_mime (1.1.2) mini_portile2 (2.8.0) - minitest (5.16.2) + minitest (5.16.3) multi_json (1.15.0) multipart-post (2.0.0) nanaimo (0.3.0) naturally (2.2.1) netrc (0.11.0) - nokogiri (1.13.8) + nokogiri (1.13.9) mini_portile2 (~> 2.8.0) racc (~> 1.4) optparse (0.1.1) os (1.1.4) plist (3.6.0) - public_suffix (4.0.7) + public_suffix (5.0.0) racc (1.6.0) rake (13.0.6) representable (3.2.0) @@ -250,7 +250,6 @@ GEM rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) - zeitwerk (2.6.0) PLATFORMS ruby diff --git a/IntegrationTests/SupportingFiles/target.yml b/IntegrationTests/SupportingFiles/target.yml index f82273c71..a6f5f8805 100644 --- a/IntegrationTests/SupportingFiles/target.yml +++ b/IntegrationTests/SupportingFiles/target.yml @@ -32,7 +32,7 @@ targets: settings: base: PRODUCT_NAME: IntegrationTests - PRODUCT_BUNDLE_IDENTIFIER: io.element.elementx.integration.tests + PRODUCT_BUNDLE_IDENTIFIER: ${BASE_BUNDLE_IDENTIFIER}.integration.tests debug: release: diff --git a/UITests/SupportingFiles/target.yml b/UITests/SupportingFiles/target.yml index f70261453..f8b74cb26 100644 --- a/UITests/SupportingFiles/target.yml +++ b/UITests/SupportingFiles/target.yml @@ -60,7 +60,7 @@ targets: settings: base: PRODUCT_NAME: UITests - PRODUCT_BUNDLE_IDENTIFIER: io.element.elementx.ui.tests + PRODUCT_BUNDLE_IDENTIFIER: ${BASE_BUNDLE_IDENTIFIER}.ui.tests debug: release: diff --git a/UnitTests/SupportingFiles/target.yml b/UnitTests/SupportingFiles/target.yml index ed95492d0..fe8c9d445 100644 --- a/UnitTests/SupportingFiles/target.yml +++ b/UnitTests/SupportingFiles/target.yml @@ -40,7 +40,7 @@ targets: settings: base: PRODUCT_NAME: UnitTests - PRODUCT_BUNDLE_IDENTIFIER: io.element.elementx.unit.tests + PRODUCT_BUNDLE_IDENTIFIER: ${BASE_BUNDLE_IDENTIFIER}.unit.tests debug: release: diff --git a/ci_scripts/ci_common.sh b/ci_scripts/ci_common.sh new file mode 100755 index 000000000..9e6fc78d2 --- /dev/null +++ b/ci_scripts/ci_common.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +setup_environment () { + # Return on failures + # Fail when expanding unset variables + # Trace each command before executing it + set -eEu + + # Move to the project root + cd .. + + # Prevent installing dependencies in system directories + echo 'export GEM_HOME=$HOME/.gem' >>~/.zshrc + echo 'export PATH=$GEM_HOME/bin:$PATH' >>~/.zshrc + echo 'export PATH="/usr/local/opt/ruby@2.7/bin:$PATH"' >> ~/.zshrc + + export GEM_HOME=$HOME/.gem + export PATH=$GEM_HOME/bin:$PATH + export PATH="/usr/local/opt/ruby@2.7/bin:$PATH" + + # Things don't work well on the default ruby version + brew install "ruby@2.7" + + gem install bundler + + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 +} + +install_brew_dependencies () { + brew install "xcodegen" + brew install "imagemagick" +} + +install_python_dependencies () { + pip3 install -r requirements.txt # Install towncrier for generating changelogs +} \ No newline at end of file diff --git a/ci_scripts/ci_post_clone.sh b/ci_scripts/ci_post_clone.sh new file mode 100755 index 000000000..8aea9ec02 --- /dev/null +++ b/ci_scripts/ci_post_clone.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +source ci_common.sh + +if [ "$CI_WORKFLOW" = "Nightly" ]; then + setup_environment + + install_brew_dependencies + + bundle exec fastlane config_nightly +fi \ No newline at end of file diff --git a/ci_scripts/ci_post_xcodebuild.sh b/ci_scripts/ci_post_xcodebuild.sh new file mode 100755 index 000000000..65cb2187d --- /dev/null +++ b/ci_scripts/ci_post_xcodebuild.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +source ci_common.sh + +setup_environment + +if [ "$CI_WORKFLOW" = "Release" ]; then + install_python_dependencies + + bundle exec fastlane release_to_github + bundle exec fastlane prepare_next_release +fi + +# Upload dsyms no matter the workflow +bundle exec fastlane upload_dsyms_to_sentry dsym_path:"$CI_ARCHIVE_PATH/dSYMs" \ No newline at end of file diff --git a/fastlane/Fastfile b/fastlane/Fastfile index e45cd4ada..78764933d 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -6,11 +6,8 @@ before_all do end lane :alpha do - config_xcodegen_alpha() - xcodegen(spec: "project.yml") - provisioning_profile_name = "ElementX PR Ad Hoc" bundle_identifier = "io.element.elementx.pr" code_signing_identity = "Apple Distribution: Vector Creations Limited (7J4U792NQT)" @@ -29,12 +26,6 @@ lane :alpha do adhoc: true ) - version = ENV["GITHUB_PR_NUMBER"] - - update_app_icon(caption_text: "PR #{version}") - - bump_build_number() - build_ios_app( scheme: "ElementX", clean: true, @@ -48,19 +39,6 @@ lane :alpha do ) upload_to_diawi() - -end - -lane :github_release do - build_adhoc() - - upload_to_diawi() - - release_to_github() - - prepare_next_release() - - upload_dsyms_to_sentry() end lane :app_store_release do @@ -70,24 +48,7 @@ lane :app_store_release do prepare_next_release() - upload_dsyms_to_sentry() -end - - -lane :build_adhoc do - bump_build_number() - - build_ios_app( - scheme: "ElementX", - clean: true, - export_method: "ad-hoc", - output_directory: "build", - export_options: { - provisioningProfiles: { - "io.element.elementx" => "ElementX Ad Hoc", - } - } - ) + upload_dsyms_to_sentry(dsym_path: './build/ElementX.app.dSYM.zip') end lane :build_release do @@ -141,47 +102,41 @@ lane :integration_tests do ) end -private_lane :bump_build_number do - # Increment build number to current date - build_number = Time.now.strftime("%Y%m%d%H%M") - increment_build_number(build_number: build_number) -end - -private_lane :config_xcodegen_alpha do - target_file_path = "../ElementX/SupportingFiles/target.yml" +lane :config_nightly do + target_file_path = "../project.yml" data = YAML.load_file target_file_path - data["targets"]["ElementX"]["settings"]["base"]["PRODUCT_NAME"] = "ElementX PR" - data["targets"]["ElementX"]["settings"]["base"]["PRODUCT_BUNDLE_IDENTIFIER"] = "io.element.elementx.pr" + data["settings"]["BASE_APP_GROUP_IDENTIFIER"] = "io.element.nightly" + data["settings"]["BASE_BUNDLE_IDENTIFIER"] = "io.element.elementx.nightly" File.open(target_file_path, 'w') { |f| YAML.dump(data, f) } + + xcodegen(spec: "project.yml") + + # Automatically done by Xcode Cloud. Cannot override + # https://developer.apple.com/documentation/xcode/setting-the-next-build-number-for-xcode-cloud-builds + # bump_build_number() + + release_version = get_version_number() + + update_app_icon(caption_text: "Nightly #{release_version}", modulate: "100,20,100") end -desc "Upload IPA to Diawi" -private_lane :upload_to_diawi do - api_token = ENV["DIAWI_API_TOKEN"] - UI.user_error!("Invalid Diawi API token.") unless !api_token.to_s.empty? +lane :upload_dsyms_to_sentry do |options| + auth_token = ENV["SENTRY_AUTH_TOKEN"] + UI.user_error!("Invalid Sentry Auth token.") unless !auth_token.to_s.empty? - # Upload to Diawi - diawi( - token: api_token, - wall_of_apps: false, - file: lane_context[SharedValues::IPA_OUTPUT_PATH] + dsym_path = options[:dsym_path] + UI.user_error!("Invalid DSYM path.") unless !dsym_path.to_s.empty? + + sentry_upload_dif( + auth_token: auth_token, + org_slug: 'element', + project_slug: 'elementx', + url: 'https://sentry.tools.element.io/', + path: dsym_path, ) - - # Get the Diawi link from Diawi action shared value - diawi_link = lane_context[SharedValues::UPLOADED_FILE_LINK_TO_DIAWI] - UI.command_output("Diawi link: " + diawi_link.to_s) - - # Generate the Diawi QR code file link - diawi_app_id = URI(diawi_link).path.split('/').last - diawi_qr_code_link = "https://www.diawi.com/qrcode/link/#{diawi_app_id}" - - # Set "DIAWI_FILE_LINK" to GitHub environment variables for Github actions - sh("echo DIAWI_FILE_LINK=#{diawi_link} >> $GITHUB_ENV") - sh("echo DIAWI_QR_CODE_LINK=#{diawi_qr_code_link} >> $GITHUB_ENV") end -desc "Create GitHub Release" -private_lane :release_to_github do +lane :release_to_github do api_token = ENV["GITHUB_TOKEN"] UI.user_error!("Invalid GitHub API token.") unless !api_token.to_s.empty? @@ -216,7 +171,7 @@ private_lane :release_to_github do end -private_lane :prepare_next_release do +lane :prepare_next_release do target_file_path = "../ElementX/SupportingFiles/target.yml" xcode_project_file_path = "../ElementX.xcodeproj" @@ -233,6 +188,54 @@ private_lane :prepare_next_release do sh("git add #{target_file_path} #{xcode_project_file_path}") sh("git commit -m 'Prepare next release'") + + sh("git push") +end + +private_lane :config_xcodegen_alpha do + target_file_path = "../project.yml" + data = YAML.load_file target_file_path + data["settings"]["BASE_APP_GROUP_IDENTIFIER"] = "io.element.pr" + data["settings"]["BASE_BUNDLE_IDENTIFIER"] = "io.element.elementx.pr" + File.open(target_file_path, 'w') { |f| YAML.dump(data, f) } + + xcodegen(spec: "project.yml") + + version = ENV["GITHUB_PR_NUMBER"] + + update_app_icon(caption_text: "PR #{version}", modulate: "100,100,200") + + bump_build_number() +end + +private_lane :upload_to_diawi do + api_token = ENV["DIAWI_API_TOKEN"] + UI.user_error!("Invalid Diawi API token.") unless !api_token.to_s.empty? + + # Upload to Diawi + diawi( + token: api_token, + wall_of_apps: false, + file: lane_context[SharedValues::IPA_OUTPUT_PATH] + ) + + # Get the Diawi link from Diawi action shared value + diawi_link = lane_context[SharedValues::UPLOADED_FILE_LINK_TO_DIAWI] + UI.command_output("Diawi link: " + diawi_link.to_s) + + # Generate the Diawi QR code file link + diawi_app_id = URI(diawi_link).path.split('/').last + diawi_qr_code_link = "https://www.diawi.com/qrcode/link/#{diawi_app_id}" + + # Set "DIAWI_FILE_LINK" to GitHub environment variables for Github actions + sh("echo DIAWI_FILE_LINK=#{diawi_link} >> $GITHUB_ENV") + sh("echo DIAWI_QR_CODE_LINK=#{diawi_qr_code_link} >> $GITHUB_ENV") +end + +private_lane :bump_build_number do + # Increment build number to current date + build_number = Time.now.strftime("%Y%m%d%H%M") + increment_build_number(build_number: build_number) end private_lane :export_version_changes do |options| @@ -246,9 +249,12 @@ private_lane :update_app_icon do |options| caption_text = options[:caption_text] UI.user_error!("Invalid caption text.") unless !caption_text.to_s.empty? + modulate = options[:modulate] + UI.user_error!("Invalid icon modulate parameters.") unless !modulate.to_s.empty? + Dir.glob("../ElementX/Resources/Assets.xcassets/AppIcon.appiconset/**/*.png") do |file_name| # Change the icons color - sh("convert '#{file_name}' -modulate 100,100,200 '#{file_name}'") + sh("convert '#{file_name}' -modulate #{modulate} '#{file_name}'") caption_width = sh("identify -format %w '#{file_name}'") caption_height = file_name.end_with?("@2x.png") ? 60 : 30 @@ -259,16 +265,3 @@ private_lane :update_app_icon do |options| end end end - -private_lane :upload_dsyms_to_sentry do - auth_token = ENV["SENTRY_AUTH_TOKEN"] - UI.user_error!("Invalid Sentry Auth token.") unless !auth_token.to_s.empty? - - sentry_upload_dif( - auth_token: auth_token, - org_slug: 'element', - project_slug: 'elementx', - url: 'https://sentry.tools.element.io/', - path: './build/ElementX.app.dSYM.zip', - ) -end diff --git a/fastlane/README.md b/fastlane/README.md index a7ca16cf5..92c4eafa8 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -21,14 +21,6 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do -### github_release - -```sh -[bundle exec] fastlane github_release -``` - - - ### app_store_release ```sh @@ -37,14 +29,6 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do -### build_adhoc - -```sh -[bundle exec] fastlane build_adhoc -``` - - - ### build_release ```sh @@ -77,6 +61,38 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do +### config_nightly + +```sh +[bundle exec] fastlane config_nightly +``` + + + +### upload_dsyms_to_sentry + +```sh +[bundle exec] fastlane upload_dsyms_to_sentry +``` + + + +### release_to_github + +```sh +[bundle exec] fastlane release_to_github +``` + + + +### prepare_next_release + +```sh +[bundle exec] fastlane prepare_next_release +``` + + + ---- This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. diff --git a/project.yml b/project.yml index ccc54e65f..6f6d61c49 100644 --- a/project.yml +++ b/project.yml @@ -22,7 +22,9 @@ options: settings: CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED: YES ENABLE_BITCODE: NO - + BASE_APP_GROUP_IDENTIFIER: io.element + APP_GROUP_IDENTIFIER: group.$(BASE_APP_GROUP_IDENTIFIER) + BASE_BUNDLE_IDENTIFIER: io.element.elementx include: - path: ElementX/SupportingFiles/target.yml