From c612c95230c2e861cf3755ffa06a76ebbedb076d Mon Sep 17 00:00:00 2001 From: Philipp Hoenisch Date: Mon, 14 Aug 2023 10:08:41 +0200 Subject: [PATCH 1/3] feat: release regtest ios app on push to main using fastlane --- .env.sample | 16 + .github/workflows/deliverables-push-main.yml | 11 +- .github/workflows/ios-fastlane.yml | 166 ++++++++++ .gitignore | 7 + RELEASE.md | 19 ++ justfile | 10 +- mobile/ios/Runner.xcodeproj/project.pbxproj | 39 ++- mobile/ios/fastlane/Appfile | 4 + mobile/ios/fastlane/Fastfile | 93 ++++++ mobile/ios/fastlane/Gemfile | 4 + mobile/ios/fastlane/Gemfile.lock | 283 ++++++++++++++++++ mobile/ios/fastlane/Matchfile | 5 + .../xcschemes/xcschememanagement.plist | 4 +- 13 files changed, 641 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/ios-fastlane.yml create mode 100644 mobile/ios/fastlane/Appfile create mode 100644 mobile/ios/fastlane/Fastfile create mode 100644 mobile/ios/fastlane/Gemfile create mode 100644 mobile/ios/fastlane/Gemfile.lock create mode 100644 mobile/ios/fastlane/Matchfile diff --git a/.env.sample b/.env.sample index 40fbf52d8..5f29d5064 100644 --- a/.env.sample +++ b/.env.sample @@ -6,3 +6,19 @@ ESPLORA_ENDPOINT=http://35.189.57.114:3000 COORDINATOR_P2P_ENDPOINT=03507b924dae6595cfb78492489978127c5f1e3877848564de2015cd6d41375802@35.189.57.114:9045 COORDINATOR_PORT_HTTP=80 NETWORK=regtest + +# Fastlane variables +FASTLANE_DEVELOPER_APP_ID="1234567890" +FASTLANE_DEVELOPER_APP_IDENTIFIER="finance.get10101.app" +FASTLANE_PROVISIONING_PROFILE_SPECIFIER="sample" +#FASTLANE_APP_SCHEME="Runner" +FASTLANE_APP_SCHEME="test" # or "Runner" +FASTLANE_APPLE_ID="main@user.com" +FASTLANE_TEMP_KEYCHAIN_USER="some@user.com" +FASTLANE_TEMP_KEYCHAIN_PASSWORD="some-random-password" +FASTLANE_APPLE_ISSUER_ID="12234124-1111-2222-3333-444444444444" +FASTLANE_APPLE_KEY_ID="123456678" +FASTLANE_APPLE_KEY_CONTENT="-----BEGIN PRIVATE KEY-----\....\n-----END PRIVATE KEY-----" +FASTLANE_GIT_AUTHORIZATION="username:github_token" +FASTLANE_APP_STORE_CONNECT_TEAM_ID=123456789 +FASTLANE_DEVELOPER_PORTAL_TEAM_ID=1234567890 diff --git a/.github/workflows/deliverables-push-main.yml b/.github/workflows/deliverables-push-main.yml index 45a276363..7d2e3b8c6 100644 --- a/.github/workflows/deliverables-push-main.yml +++ b/.github/workflows/deliverables-push-main.yml @@ -33,19 +33,22 @@ jobs: - 'mobile/**' - 'Cargo.*' - build_and_release_ios_app_for_latest_main: + build_and_release_regtest_ios_app_for_latest_main: needs: changes - if: needs.changes.outputs.ios-app == 'true' && contains(github.event.head_commit.message, 'release') == 'false' && contains(github.event.head_commit.message, 'Merge') == 'false' + if: needs.changes.outputs.ios-app == 'true' permissions: packages: write contents: read - uses: ./.github/workflows/ios.yml + uses: ./.github/workflows/ios-fastlane.yml secrets: inherit with: - esplora_endpoint: https://blockstream.info/api + esplora_endpoint: http://35.189.57.114:3000 coordinator_p2p_endpoint: 03507b924dae6595cfb78492489978127c5f1e3877848564de2015cd6d41375802@35.189.57.114:9045 coordinator_port_http: 80 network: regtest tag: main oracle_endpoint: http://api.test.10101.finance:8081 oracle_pubkey: 5d12d79f575b8d99523797c46441c0549eb0defb6195fe8a080000cbe3ab3859 + fastlane_developer_app_identifier: finance.get10101.app.test + fastlane_provisioning_profile_specifier: match AppStore finance.get10101.app.test + app_scheme: test diff --git a/.github/workflows/ios-fastlane.yml b/.github/workflows/ios-fastlane.yml new file mode 100644 index 000000000..671f764db --- /dev/null +++ b/.github/workflows/ios-fastlane.yml @@ -0,0 +1,166 @@ +name: "Fastlane: Build and release ios app to TestFlight" + +on: + workflow_call: + inputs: + coordinator_port_http: + required: true + type: string + esplora_endpoint: + required: true + type: string + coordinator_p2p_endpoint: + required: true + type: string + network: + required: true + type: string + description: "The target network for the release, e.g. mainnet/regtest" + tag: + required: true + description: "The branch, tag or SHA to checkout." + type: string + oracle_endpoint: + required: true + type: string + oracle_pubkey: + required: true + description: "The public key of the oracle. Must match with the public key returned at http://${oracle_endpoint}/oracle/publickey" + type: string + app_scheme: + required: true + description: "For regtest enter 'test' or mainnet enter 'Runner'" + type: string + fastlane_provisioning_profile_specifier: + required: true + description: "For regtest enter 'match AppStore finance.get10101.app.test' or mainnet enter 'match AppStore finance.get10101.app 1691412333'" + type: string + fastlane_developer_app_identifier: + required: true + description: "For regtest enter 'finance.get10101.app.test' or mainnet enter 'finance.get10101.app'" + type: string + workflow_dispatch: + inputs: + coordinator_port_http: + required: true + type: string + esplora_endpoint: + required: true + type: string + coordinator_p2p_endpoint: + required: true + type: string + network: + required: true + type: string + description: "The target network for the release, e.g. mainnet/regtest" + tag: + required: true + description: "The branch, tag or SHA to checkout." + type: string + oracle_endpoint: + required: true + type: string + oracle_pubkey: + required: true + description: "The public key of the oracle. Must match with the public key returned at http://${oracle_endpoint}/oracle/publickey" + type: string + +jobs: + build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + with: + # fetch the complete history to correctly calculate build_number + fetch-depth: 0 + ref: ${{ inputs.tag }} + + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: "14.2" + + - uses: subosito/flutter-action@v2 + with: + channel: "stable" + flutter-version: ${{ env.FLUTTER_VERSION }} + architecture: x64 + + - uses: actions/cache@v3 + id: cache-deps + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + ./rust/target + key: ${{ runner.os }}-cargo-build-release-ios-${{ hashFiles('**/Cargo.lock') }} + + - name: Install just + if: steps.cache-deps.outputs.cache-hit != 'true' + run: cargo install just + + - name: Install fastlane + run: | + cd mobile/ios/fastlane + gem install bundler + bundle install + bundle info fastlane + + - name: Install FFI bindings + if: steps.cache-deps.outputs.cache-hit != 'true' + run: just deps-gen + + - name: Install ios dependencies + if: steps.cache-deps.outputs.cache-hit != 'true' + run: cargo install cargo-lipo + + - name: Set rustup targets + run: rustup target add aarch64-apple-ios x86_64-apple-ios + + - name: Generate FFI bindings + run: just gen + + - name: Build iOS Rust lib in release mode + run: just ios-release + + - name: Parse version from pubspec.yaml + id: version + uses: jbutcher5/read-yaml@1.6 + with: + file: "mobile/pubspec.yaml" + key-path: '["version"]' + + - name: Build iOS Archive + id: build-ios + run: | + NETWORK=$NETWORK just build-ipa-no-codesign + env: + ESPLORA_ENDPOINT: ${{ inputs.esplora_endpoint }} + COORDINATOR_P2P_ENDPOINT: ${{ inputs.coordinator_p2p_endpoint }} + NETWORK: ${{ inputs.network }} + COORDINATOR_PORT_HTTP: ${{ inputs.coordinator_port_http }} + ORACLE_ENDPOINT: ${{ inputs.oracle_endpoint }} + ORACLE_PUBKEY: ${{ inputs.oracle_pubkey }} + + - name: Release to TestFlight + env: + # secrets + FASTLANE_APPLE_ID: ${{ secrets.FASTLANE_APPLE_ID }} + FASTLANE_APP_STORE_CONNECT_TEAM_ID: ${{ secrets.FASTLANE_APP_STORE_CONNECT_TEAM_ID }} + FASTLANE_DEVELOPER_PORTAL_TEAM_ID: ${{ secrets.FASTLANE_DEVELOPER_PORTAL_TEAM_ID }} + FASTLANE_DEVELOPER_APP_ID: ${{ secrets.FASTLANE_DEVELOPER_APP_ID }} + FASTLANE_TEMP_KEYCHAIN_USER: ${{ secrets.FASTLANE_TEMP_KEYCHAIN_USER }} + FASTLANE_TEMP_KEYCHAIN_PASSWORD: ${{ secrets.FASTLANE_TEMP_KEYCHAIN_PASSWORD }} + FASTLANE_APPLE_ISSUER_ID: ${{ secrets.FASTLANE_APPLE_ISSUER_ID }} + FASTLANE_APPLE_KEY_ID: ${{ secrets.FASTLANE_APPLE_KEY_ID }} + FASTLANE_APPLE_KEY_CONTENT: ${{ secrets.FASTLANE_APPLE_KEY_CONTENT }} + FASTLANE_GIT_AUTHORIZATION: ${{ secrets.FASTLANE_GIT_AUTHORIZATION }} + MATCH_PASSWORD: ${{ secrets.FASTLANE_MATCH_PASSWORD }} + # inputs + FASTLANE_DEVELOPER_APP_IDENTIFIER: ${{ inputs.fastlane_developer_app_identifier }} + FASTLANE_PROVISIONING_PROFILE_SPECIFIER: ${{ inputs.fastlane_provisioning_profile_specifier }} + FASTLANE_APP_SCHEME: ${{ inputs.app_scheme }} + run: | + just publish-testflight-fastlane diff --git a/.gitignore b/.gitignore index 846438934..1004afc19 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,10 @@ data/** # prometheus data services/prometheus/data + +# fastlane generated files +10101.app.dSYM.zip +10101.ipa +mobile/ios/build +mobile/ios/fastlane/report.xml +mobile/ios/fastlane/README.md diff --git a/RELEASE.md b/RELEASE.md index 649d85d97..131e40dfc 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -49,3 +49,22 @@ just release-testflight ``` Once uploaded, log into `appstoreconnect.apple.com/apps/` and approve testing the new version. + +## Using fastlane + +Make sure that all environment variables are set in the `.env` file. + +You will also need to install [`fastlane`](https://fastlane.tools/). + +1. We need to build the IPA file first without code signing because fastlane does not support `--dart-define`. + Building the IPA file adds some overheads but ensures that these variables are set. + +```bash +just build-ipa-no-codesign +``` + +2. Execute fastlane to build a signed IPA file and upload to Testflight + +```bash +just publish-testflight-fastlane +``` diff --git a/justfile b/justfile index a64f032db..e8c3dc727 100644 --- a/justfile +++ b/justfile @@ -328,7 +328,7 @@ wait-for-coordinator-to-be-ready: echo "Max attempts reached. Coordinator is still not ready." exit 1 -build-ipa: +build-ipa args="": #!/usr/bin/env bash BUILD_NUMBER=$(git rev-list HEAD --count) args=() @@ -344,11 +344,17 @@ build-ipa: --dart-define="COMMIT=$(git rev-parse HEAD)" \ --dart-define="BRANCH=$(git rev-parse --abbrev-ref HEAD)" \ --dart-define="COORDINATOR_PORT_HTTP=${COORDINATOR_PORT_HTTP}" \ - --build-number=${BUILD_NUMBER} + --build-number=${BUILD_NUMBER} \ + {{args}} publish-testflight: cd mobile && xcrun altool --upload-app --type ios --file ./build/ios/ipa/10101.ipa --apiKey ${ALTOOL_API_KEY} --apiIssuer ${ALTOOL_API_ISSUER} +build-ipa-no-codesign: (build-ipa "--no-codesign") + +publish-testflight-fastlane: + cd mobile/ios/fastlane && bundle exec fastlane closed_beta --verbose + release-testflight: gen ios build-ipa publish-testflight version: diff --git a/mobile/ios/Runner.xcodeproj/project.pbxproj b/mobile/ios/Runner.xcodeproj/project.pbxproj index 850d126f8..97e6e8f30 100644 --- a/mobile/ios/Runner.xcodeproj/project.pbxproj +++ b/mobile/ios/Runner.xcodeproj/project.pbxproj @@ -436,6 +436,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; @@ -458,7 +459,7 @@ PRODUCT_BUNDLE_IDENTIFIER = finance.get10101.app; PRODUCT_NAME = 10101; PROVISIONING_PROFILE_SPECIFIER = ""; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "TestFlight Get10101 Provisioning"; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore finance.get10101.app 1691412333"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; @@ -582,9 +583,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = V3D64P9D6W; + DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = V3D64P9D6W; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -602,7 +605,8 @@ ); PRODUCT_BUNDLE_IDENTIFIER = finance.get10101.app; PRODUCT_NAME = 10101; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "TestFlight Get10101 Provisioning"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore finance.get10101.app 1691412333"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -616,9 +620,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = V3D64P9D6W; + CODE_SIGN_STYLE = Manual; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = V3D64P9D6W; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -637,7 +643,7 @@ PRODUCT_BUNDLE_IDENTIFIER = finance.get10101.app; PRODUCT_NAME = 10101; PROVISIONING_PROFILE_SPECIFIER = ""; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "TestFlight Get10101 Provisioning"; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore finance.get10101.app 1691412333"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; @@ -708,9 +714,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-test"; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = V3D64P9D6W; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = V3D64P9D6W; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -728,6 +736,7 @@ PRODUCT_BUNDLE_IDENTIFIER = finance.get10101.app.test; PRODUCT_NAME = "10101 Test"; PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore finance.get10101.app.test"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -796,9 +805,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-test"; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = V3D64P9D6W; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = V3D64P9D6W; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -816,6 +827,7 @@ PRODUCT_BUNDLE_IDENTIFIER = finance.get10101.app.test; PRODUCT_NAME = "10101 Test"; PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore finance.get10101.app.test"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; @@ -881,9 +893,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-test"; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = V3D64P9D6W; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = V3D64P9D6W; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -901,6 +915,7 @@ PRODUCT_BUNDLE_IDENTIFIER = finance.get10101.app.test; PRODUCT_NAME = "10101 Test"; PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore finance.get10101.app.test"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; diff --git a/mobile/ios/fastlane/Appfile b/mobile/ios/fastlane/Appfile new file mode 100644 index 000000000..d51e35527 --- /dev/null +++ b/mobile/ios/fastlane/Appfile @@ -0,0 +1,4 @@ +app_identifier(ENV["FASTLANE_DEVELOPER_APP_IDENTIFIER"]) +apple_id(ENV["FASTLANE_APPLE_ID"]) +itc_team_id(ENV["FASTLANE_APP_STORE_CONNECT_TEAM_ID"]) +team_id(ENV["FASTLANE_DEVELOPER_PORTAL_TEAM_ID"]) diff --git a/mobile/ios/fastlane/Fastfile b/mobile/ios/fastlane/Fastfile new file mode 100644 index 000000000..f261e6e55 --- /dev/null +++ b/mobile/ios/fastlane/Fastfile @@ -0,0 +1,93 @@ +default_platform(:ios) + +DEVELOPER_APP_ID = ENV["FASTLANE_DEVELOPER_APP_ID"] +DEVELOPER_APP_IDENTIFIER = ENV["FASTLANE_DEVELOPER_APP_IDENTIFIER"] +PROVISIONING_PROFILE_SPECIFIER = ENV["FASTLANE_PROVISIONING_PROFILE_SPECIFIER"] +TEMP_KEYCHAIN_USER = ENV["FASTLANE_TEMP_KEYCHAIN_USER"] +TEMP_KEYCHAIN_PASSWORD = ENV["FASTLANE_TEMP_KEYCHAIN_PASSWORD"] +APPLE_ISSUER_ID = ENV["FASTLANE_APPLE_ISSUER_ID"] +APPLE_KEY_ID = ENV["FASTLANE_APPLE_KEY_ID"] +APPLE_KEY_CONTENT = ENV["FASTLANE_APPLE_KEY_CONTENT"] +GIT_AUTHORIZATION = ENV["FASTLANE_GIT_AUTHORIZATION"] +APP_SCHEME = ENV["FASTLANE_APP_SCHEME"] + +def delete_temp_keychain(name) + delete_keychain( + name: name + ) if File.exist? File.expand_path("~/Library/Keychains/#{name}-db") +end + +def create_temp_keychain(name, password) + create_keychain( + name: name, + password: password, + unlock: false, + timeout: 0 + ) +end + +def ensure_temp_keychain(name, password) + delete_temp_keychain(name) + create_temp_keychain(name, password) +end + +platform :ios do + + lane :closed_beta do + keychain_name = TEMP_KEYCHAIN_USER + keychain_password = TEMP_KEYCHAIN_PASSWORD + ensure_temp_keychain(keychain_name, keychain_password) + + api_key = app_store_connect_api_key( + key_id: APPLE_KEY_ID, + issuer_id: APPLE_ISSUER_ID, + key_content: APPLE_KEY_CONTENT, + duration: 1200, + in_house: false + ) + + build_number = sh("git", "rev-list", "HEAD", "--count") + increment_build_number( + build_number: build_number, + xcodeproj: "Runner.xcodeproj" + ) + + cocoapods( + clean_install: true + ) + + match( + type: 'appstore', + app_identifier: "#{DEVELOPER_APP_IDENTIFIER}", + git_basic_authorization: Base64.strict_encode64(GIT_AUTHORIZATION), + readonly: true, + keychain_name: keychain_name, + keychain_password: keychain_password, + api_key: api_key + ) + + gym( + workspace: "Runner.xcworkspace", + scheme: APP_SCHEME, + export_method: "app-store", + export_options: { + provisioningProfiles: { + DEVELOPER_APP_ID => PROVISIONING_PROFILE_SPECIFIER + } + } + ) + + pilot( + apple_id: "#{DEVELOPER_APP_ID}", + app_identifier: "#{DEVELOPER_APP_IDENTIFIER}", + skip_waiting_for_build_processing: true, + skip_submission: true, + distribute_external: false, + notify_external_testers: false, + ipa: "./10101.ipa" + ) + + delete_temp_keychain(keychain_name) + end + +end diff --git a/mobile/ios/fastlane/Gemfile b/mobile/ios/fastlane/Gemfile new file mode 100644 index 000000000..82d1e3049 --- /dev/null +++ b/mobile/ios/fastlane/Gemfile @@ -0,0 +1,4 @@ +source "https://rubygems.org" + +gem "fastlane" +gem "cocoapods" diff --git a/mobile/ios/fastlane/Gemfile.lock b/mobile/ios/fastlane/Gemfile.lock new file mode 100644 index 000000000..3efefe1ce --- /dev/null +++ b/mobile/ios/fastlane/Gemfile.lock @@ -0,0 +1,283 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.6) + rexml + activesupport (5.2.8.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + addressable (2.8.5) + public_suffix (>= 2.0.2, < 6.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) + artifactory (3.0.15) + atomos (0.1.3) + aws-eventstream (1.2.0) + aws-partitions (1.798.0) + aws-sdk-core (3.180.1) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.651.0) + aws-sigv4 (~> 1.5) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.71.0) + aws-sdk-core (~> 3, >= 3.177.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.132.0) + aws-sdk-core (~> 3, >= 3.179.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.6) + aws-sigv4 (1.6.0) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + claide (1.1.0) + cocoapods (1.10.2) + addressable (~> 2.6) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.10.2) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 1.4.0, < 2.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.4.0, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.3.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.6.6) + nap (~> 1.0) + ruby-macho (~> 1.4) + xcodeproj (>= 1.19.0, < 2.0) + cocoapods-core (1.10.2) + activesupport (> 5.0, < 6) + addressable (~> 2.6) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + netrc (~> 0.11) + public_suffix + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.5) + cocoapods-downloader (1.6.3) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.1) + cocoapods-trunk (1.6.0) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.2.0) + colored (1.2) + colored2 (3.1.2) + commander (4.6.0) + highline (~> 2.0.0) + concurrent-ruby (1.2.2) + declarative (0.0.20) + digest-crc (0.6.5) + rake (>= 12.0.0, < 14.0.0) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) + dotenv (2.8.1) + emoji_regex (3.2.3) + escape (0.0.4) + ethon (0.16.0) + ffi (>= 1.15.0) + excon (0.100.0) + faraday (1.10.3) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + faraday_middleware (1.2.0) + faraday (~> 1.0) + fastimage (2.2.7) + fastlane (2.214.0) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.8, < 3.0.0) + artifactory (~> 3.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.3, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored + commander (~> 4.6) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 1.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 1.0) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + json (< 3.0.0) + jwt (>= 2.1.0, < 3) + mini_magick (>= 4.9.4, < 5.0.0) + multipart-post (>= 2.0.0, < 3.0.0) + naturally (~> 2.2) + optparse (~> 0.1.1) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 2.0.0, < 3.0.0) + security (= 0.1.3) + simctl (~> 1.6.3) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (>= 1.4.5, < 2.0.0) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3) + ffi (1.15.5) + fourflusher (2.3.1) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.47.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-core (0.11.1) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + webrick + google-apis-iamcredentials_v1 (0.17.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-playcustomapp_v1 (0.13.0) + google-apis-core (>= 0.11.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.3.1) + google-cloud-storage (1.44.0) + addressable (~> 2.8) + digest-crc (~> 0.4) + google-apis-iamcredentials_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.7.0) + faraday (>= 0.17.3, < 3.a) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + highline (2.0.3) + http-cookie (1.0.5) + domain_name (~> 0.5) + httpclient (2.8.3) + i18n (1.14.1) + concurrent-ruby (~> 1.0) + jmespath (1.6.2) + json (2.6.3) + jwt (2.7.1) + memoist (0.16.2) + mini_magick (4.12.0) + mini_mime (1.1.2) + minitest (5.19.0) + molinillo (0.6.6) + multi_json (1.15.0) + multipart-post (2.3.0) + nanaimo (0.3.0) + nap (1.1.0) + naturally (2.2.1) + netrc (0.11.0) + optparse (0.1.1) + os (1.1.4) + plist (3.7.0) + public_suffix (5.0.3) + rake (13.0.6) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rexml (3.2.6) + rouge (2.0.7) + ruby-macho (1.4.0) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + security (0.1.3) + signet (0.17.0) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.10) + CFPropertyList + naturally + terminal-notifier (2.0.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + thread_safe (0.3.6) + trailblazer-option (0.1.2) + tty-cursor (0.7.1) + tty-screen (0.8.1) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (1.2.11) + thread_safe (~> 0.1) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.8.2) + unicode-display_width (1.8.0) + webrick (1.8.1) + word_wrap (1.0.0) + xcodeproj (1.22.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.1) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + arm64-darwin-22 + +DEPENDENCIES + cocoapods + fastlane + +BUNDLED WITH + 2.3.26 diff --git a/mobile/ios/fastlane/Matchfile b/mobile/ios/fastlane/Matchfile new file mode 100644 index 000000000..9227311de --- /dev/null +++ b/mobile/ios/fastlane/Matchfile @@ -0,0 +1,5 @@ +git_url("https://github.com/bonomat/fastlane-10101-match.git") + +storage_mode("git") + +type("appstore") diff --git a/mobile/native/native.xcodeproj/xcuserdata/bonomat.xcuserdatad/xcschemes/xcschememanagement.plist b/mobile/native/native.xcodeproj/xcuserdata/bonomat.xcuserdatad/xcschemes/xcschememanagement.plist index 21313b547..86864fa19 100644 --- a/mobile/native/native.xcodeproj/xcuserdata/bonomat.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/mobile/native/native.xcodeproj/xcuserdata/bonomat.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,12 +7,12 @@ native-cdylib.xcscheme_^#shared#^_ orderHint - 8 + 10 native-staticlib.xcscheme_^#shared#^_ orderHint - 7 + 11 From 3a5be6f04e7fd132078249ac6125578d99b9237c Mon Sep 17 00:00:00 2001 From: Philipp Hoenisch Date: Tue, 8 Aug 2023 21:02:05 +0200 Subject: [PATCH 2/3] feat: use ci pipeline for mainnet release --- .github/workflows/build-release-binaries.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-release-binaries.yml b/.github/workflows/build-release-binaries.yml index a1c087fc5..c3af9b111 100644 --- a/.github/workflows/build-release-binaries.yml +++ b/.github/workflows/build-release-binaries.yml @@ -18,11 +18,11 @@ jobs: with: tag: ${{ github.ref_name }} - build_testflight_release: + build_and_release_mainnet_ios_app_for_latest_main: permissions: packages: write contents: read - uses: ./.github/workflows/ios.yml + uses: ./.github/workflows/ios-fastlane.yml secrets: inherit with: esplora_endpoint: https://blockstream.info/api @@ -32,6 +32,9 @@ jobs: tag: ${{ github.ref_name }} oracle_endpoint: https://oracle.holzeis.me oracle_pubkey: 16f88cf7d21e6c0f46bcbc983a4e3b19726c6c98858cc31c83551a88fde171c0 + fastlane_developer_app_identifier: finance.get10101.app + fastlane_provisioning_profile_specifier: match AppStore finance.get10101.app 1691412333" + app_scheme: Runner build_android_apk: runs-on: macos-latest From 57d1a2ea4d7141b91e5b161267ee9ff62b5ee5d0 Mon Sep 17 00:00:00 2001 From: Philipp Hoenisch Date: Mon, 14 Aug 2023 10:19:01 +0200 Subject: [PATCH 3/3] chore: derive app_scheme from network --- .github/workflows/build-release-binaries.yml | 1 - .github/workflows/deliverables-push-main.yml | 1 - .github/workflows/ios-fastlane.yml | 13 ++++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-release-binaries.yml b/.github/workflows/build-release-binaries.yml index c3af9b111..3cd841de2 100644 --- a/.github/workflows/build-release-binaries.yml +++ b/.github/workflows/build-release-binaries.yml @@ -34,7 +34,6 @@ jobs: oracle_pubkey: 16f88cf7d21e6c0f46bcbc983a4e3b19726c6c98858cc31c83551a88fde171c0 fastlane_developer_app_identifier: finance.get10101.app fastlane_provisioning_profile_specifier: match AppStore finance.get10101.app 1691412333" - app_scheme: Runner build_android_apk: runs-on: macos-latest diff --git a/.github/workflows/deliverables-push-main.yml b/.github/workflows/deliverables-push-main.yml index 7d2e3b8c6..9ee3c9cac 100644 --- a/.github/workflows/deliverables-push-main.yml +++ b/.github/workflows/deliverables-push-main.yml @@ -51,4 +51,3 @@ jobs: oracle_pubkey: 5d12d79f575b8d99523797c46441c0549eb0defb6195fe8a080000cbe3ab3859 fastlane_developer_app_identifier: finance.get10101.app.test fastlane_provisioning_profile_specifier: match AppStore finance.get10101.app.test - app_scheme: test diff --git a/.github/workflows/ios-fastlane.yml b/.github/workflows/ios-fastlane.yml index 671f764db..ce5970338 100644 --- a/.github/workflows/ios-fastlane.yml +++ b/.github/workflows/ios-fastlane.yml @@ -27,10 +27,6 @@ on: required: true description: "The public key of the oracle. Must match with the public key returned at http://${oracle_endpoint}/oracle/publickey" type: string - app_scheme: - required: true - description: "For regtest enter 'test' or mainnet enter 'Runner'" - type: string fastlane_provisioning_profile_specifier: required: true description: "For regtest enter 'match AppStore finance.get10101.app.test' or mainnet enter 'match AppStore finance.get10101.app 1691412333'" @@ -161,6 +157,13 @@ jobs: # inputs FASTLANE_DEVELOPER_APP_IDENTIFIER: ${{ inputs.fastlane_developer_app_identifier }} FASTLANE_PROVISIONING_PROFILE_SPECIFIER: ${{ inputs.fastlane_provisioning_profile_specifier }} - FASTLANE_APP_SCHEME: ${{ inputs.app_scheme }} + NETWORK: ${{ inputs.network }} run: | + if [ "$NETWORK" = "mainnet" ]; then + FASTLANE_APP_SCHEME="Runner" + else + FASTLANE_APP_SCHEME="test" + fi + + echo "APP_SCHEME is set to $FASTLANE_APP_SCHEME" just publish-testflight-fastlane