diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 524303b..77903f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,46 +1,150 @@ -name: Release +name: Release Workflow on: - push: - branches: - - main + workflow_dispatch: + inputs: + version_type: + description: "Type of version bump (major, minor, patch, premajor, preminor, prepatch, prerelease)" + required: true + default: "patch" + type: choice + options: + - major + - minor + - patch + - premajor + - preminor + - prepatch + - prerelease jobs: - release: + # Job 1: Version Bumping and Android Build + build_android: runs-on: ubuntu-latest + permissions: + contents: 'write' # Allows workflow to checkout repository code + id-token: 'write' # Required for Google Cloud Workload Identity Federation authentication (OIDC token generation) + steps: - # Step 1: Check out the repository - - name: Check out code - uses: actions/checkout@v3 + # Step 1: Checkout the code + - name: Checkout code + uses: actions/checkout@v4 - # Step 2: Set up Node.js + # Step 2: Set up JDK 17 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + # Step 3: Set up Node.js - name: Set up Node.js uses: actions/setup-node@v3 with: - node-version: '16' + node-version: '20.18.0' # Use the specified Node.js version + cache: 'yarn' - # Step 3: Install dependencies + # Step 4: Install dependencies using Yarn - name: Install dependencies run: yarn install - # Step 4: Run release-please to create a release PR with version bump and changelog - - name: Run release-please - uses: google-github-actions/release-please-action@v3 + # Step 5: Set up Ruby and Bundler + - name: Set up Ruby + uses: ruby/setup-ruby@v1 with: - release-type: node - package-name: your-app-name + ruby-version: '3.2.3' # Specify a Ruby version + bundler-cache: true + + # Step 6: Combined version bump + - name: Bump versions + working-directory: ${{ github.workspace }} + run: bundle exec fastlane bump_version version_type:${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type || 'patch' }} + + # Step 7: Commit and push version changes + - name: Commit and push version changes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git add .version package.json android/app/build.gradle ios/PocketPal.xcodeproj/project.pbxproj + git commit -m "chore(release): bump version to $(cat .version)" + git push + git tag "v$(cat .version)" + git push origin "v$(cat .version)" - # Step 5: Sync iOS and Android versions using react-native-version - - name: Sync iOS and Android versions + # Step 8: Set up Android Keystore + - name: Set up Android Keystore + working-directory: android run: | - CURRENT_VERSION=$(cat package.json | grep version | head -n 1 | awk -F: '{ print $2 }' | sed 's/[",]//g') - yarn react-native-version --target $CURRENT_VERSION + echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > keystore.jks + + # Step 9: Authenticate to Google Cloud + - name: Authenticate to Google Cloud + id: auth + uses: google-github-actions/auth@v2 + with: + service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} + workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }} + create_credentials_file: true - # Step 6: Commit the iOS and Android version bumps - - name: Commit version updates + # Step 10: Build and upload Android app to Alpha track + - name: Build and upload Android app + working-directory: android + env: + KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} + KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} + KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} + GRADLE_USER_HOME: ${{ runner.temp }}/.gradle + # GOOGLE_APPLICATION_CREDENTIALS: ${{ steps.auth.outputs.credentials_file_path }} # This is not supported by fastlane, we need to replace it with PLAY_STORE_JSON_KEY in the future. + PLAY_STORE_JSON_KEY: ${{ secrets.PLAY_STORE_SERVICE_ACCOUNT_JSON }} run: | - git config --global user.email "github-actions[bot]@users.noreply.github.com" - git config --global user.name "GitHub Actions" - git add . - git commit -m "chore(release): sync iOS and Android versions" - git push origin main + echo "$PLAY_STORE_JSON_KEY" > play-store-key.json + bundle exec fastlane release_android_alpha + + # Job 2: iOS Build and Upload (runs on macOS) + build_ios: + runs-on: macos-latest + needs: build_android + + steps: + - name: Checkout code # Replace the Download code step + uses: actions/checkout@v3 + with: + ref: ${{ github.ref }} # This ensures we get the latest changes including the version bump + + # Step 2: Set up Node.js + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '20.18.0' + cache: 'yarn' + + # Step 3: Install dependencies using Yarn + - name: Install dependencies + run: yarn install + + # Step 4: Set up Ruby and Bundler + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2.3' # Specify a Ruby version + bundler-cache: true + + # Step 5: Install CocoaPods dependencies + - name: Install CocoaPods dependencies + working-directory: ios + run: pod install + + # Step 6: Build and upload iOS app to TestFlight + - name: Build and upload iOS app + working-directory: ios + env: + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} + MATCH_GITHUB_TOKEN: ${{ secrets.MATCH_GITHUB_TOKEN }} + APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }} + APP_STORE_CONNECT_API_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_ISSUER_ID }} + APP_STORE_CONNECT_API_KEY_CONTENT: ${{ secrets.APP_STORE_CONNECT_API_KEY_CONTENT }} + APP_STORE_CONNECT_USER_ID: ${{ secrets.APP_STORE_CONNECT_USER_ID }} + run: bundle exec fastlane release_ios diff --git a/.version b/.version new file mode 100644 index 0000000..a7ccabd --- /dev/null +++ b/.version @@ -0,0 +1 @@ +1.5.20 diff --git a/Gemfile b/Gemfile index 4ab0b02..4810d8a 100644 --- a/Gemfile +++ b/Gemfile @@ -7,3 +7,8 @@ ruby "3.2.3" # bound in the template on Cocoapods with next React Native release. gem 'cocoapods', '>= 1.13', '< 1.15' gem 'activesupport', '>= 6.1.7.5', '< 7.1.0' + +# Fastlane +gem "fastlane" +gem "fastlane-plugin-versioning" +gem 'fastlane-plugin-versioning_android' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index e714bcc..d658379 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,7 +15,25 @@ GEM algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) + artifactory (3.0.17) atomos (0.1.3) + aws-eventstream (1.3.0) + aws-partitions (1.1013.0) + aws-sdk-core (3.214.0) + aws-eventstream (~> 1, >= 1.3.0) + aws-partitions (~> 1, >= 1.992.0) + aws-sigv4 (~> 1.9) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.96.0) + aws-sdk-core (~> 3, >= 3.210.0) + aws-sigv4 (~> 1.5) + aws-sdk-s3 (1.174.0) + aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.5) + aws-sigv4 (1.10.1) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) base64 (0.2.0) claide (1.1.0) cocoapods (1.14.3) @@ -55,32 +73,197 @@ GEM 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.3) + declarative (0.0.20) + digest-crc (0.6.5) + rake (>= 12.0.0, < 14.0.0) + domain_name (0.6.20240107) + dotenv (2.8.1) + emoji_regex (3.2.3) escape (0.0.4) ethon (0.16.0) ffi (>= 1.15.0) + excon (0.112.0) + faraday (1.10.4) + 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.2) + 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.1) + faraday (~> 1.0) + fastimage (2.3.1) + fastlane (2.225.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 (~> 1.2) + 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) + fastlane-sirp (>= 1.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-env (>= 1.6.0, < 2.0.0) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + http-cookie (~> 1.0.5) + 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, < 1.0.0) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 2.0.0, < 3.0.0) + security (= 0.1.5) + simctl (~> 1.6.3) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (~> 3) + 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, < 2.0.0) + fastlane-plugin-versioning (0.7.0) + fastlane-plugin-versioning_android (0.1.1) + fastlane-sirp (1.0.0) + sysrandom (~> 1.0) ffi (1.16.3) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.54.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-core (0.11.3) + 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 + 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.31.0) + google-apis-core (>= 0.11.0, < 2.a) + google-cloud-core (1.7.1) + google-cloud-env (>= 1.0, < 3.a) + google-cloud-errors (~> 1.0) + google-cloud-env (1.6.0) + faraday (>= 0.17.3, < 3.0) + google-cloud-errors (1.4.0) + google-cloud-storage (1.47.0) + addressable (~> 2.8) + digest-crc (~> 0.4) + google-apis-iamcredentials_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.31.0) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) + mini_mime (~> 1.0) + googleauth (1.8.1) + faraday (>= 0.17.3, < 3.a) + jwt (>= 1.4, < 3.0) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + highline (2.0.3) + http-cookie (1.0.7) + domain_name (~> 0.5) httpclient (2.8.3) i18n (1.14.4) concurrent-ruby (~> 1.0) + jmespath (1.6.2) json (2.7.2) + jwt (2.9.3) + base64 + mini_magick (4.13.2) + mini_mime (1.1.5) minitest (5.22.3) molinillo (0.8.0) + multi_json (1.15.0) + multipart-post (2.4.1) nanaimo (0.3.0) nap (1.1.0) + naturally (2.2.1) netrc (0.11.0) nkf (0.2.0) + optparse (0.6.0) + os (1.1.4) + plist (3.7.1) public_suffix (4.0.7) + rake (13.2.1) + 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 (2.5.1) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + security (0.1.5) + signet (0.19.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 + sysrandom (1.0.5) + terminal-notifier (2.0.0) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + trailblazer-option (0.1.2) + tty-cursor (0.7.1) + tty-screen (0.8.2) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) + uber (0.1.0) + unicode-display_width (2.6.0) + word_wrap (1.0.0) xcodeproj (1.24.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) @@ -88,6 +271,10 @@ GEM 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 ruby @@ -95,6 +282,9 @@ PLATFORMS DEPENDENCIES activesupport (>= 6.1.7.5, < 7.1.0) cocoapods (>= 1.13, < 1.15) + fastlane + fastlane-plugin-versioning + fastlane-plugin-versioning_android RUBY VERSION ruby 3.2.3p157 diff --git a/android/app/build.gradle b/android/app/build.gradle index e717d8b..7f59597 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -81,8 +81,8 @@ android { applicationId "com.pocketpalai" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 16 - versionName "1.5.2" + versionCode 31 + versionName "1.5.20" ndk { abiFilters "arm64-v8a", "x86_64" } diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile new file mode 100644 index 0000000..e8152a6 --- /dev/null +++ b/android/fastlane/Fastfile @@ -0,0 +1,27 @@ +default_platform :android + +platform :android do + desc "Release Android app to Alpha track" + lane :release_android_alpha do + android_dir = File.expand_path('..', Dir.pwd) + gradle( + task: "bundle", + build_type: "Release", + properties: { + "android.injected.signing.store.file" => File.join(android_dir, "keystore.jks"), + "android.injected.signing.store.password" => ENV["KEYSTORE_PASSWORD"], + "android.injected.signing.key.alias" => ENV["KEY_ALIAS"], + "android.injected.signing.key.password" => ENV["KEY_PASSWORD"] + } + ) + + upload_to_play_store( + track: "alpha", + package_name: "com.pocketpalai", + skip_upload_metadata: true, + skip_upload_images: true, + skip_upload_screenshots: true, + json_key: File.join(android_dir, "play-store-key.json") + ) + end +end diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 0000000..d4d6792 --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,50 @@ +desc "Bump version for both Android and iOS" +lane :bump_version do |options| + version_type = options[:version_type] || "patch" + root_dir = File.expand_path('..', Dir.pwd) + + # Common paths + package_json_path = File.join(root_dir, 'package.json') + version_file_path = File.join(root_dir, '.version') + + # Bump version in package.json + Dir.chdir(root_dir) do + sh("yarn version --#{version_type} --no-git-tag-version") + end + + new_version = JSON.parse(File.read(package_json_path))['version'] + sh("echo #{new_version} > #{version_file_path}") + + # For Android: Read current version code and increment it + gradle_file = File.join(root_dir, "android/app/build.gradle") + current_version_code = android_get_version_code(gradle_file: gradle_file).to_i + new_version_code = current_version_code + 1 + + # Update Android version + android_set_version_code( + gradle_file: gradle_file, + version_code: new_version_code + ) + + android_set_version_name( + gradle_file: gradle_file, + version_name: new_version + ) + + # For iOS: Bump version and build number + ios_dir = File.join(root_dir, 'ios') + Dir.chdir(ios_dir) do + increment_version_number_in_xcodeproj( + version_number: new_version, + xcodeproj: File.join(ios_dir, "PocketPal.xcodeproj") + ) + increment_build_number_in_xcodeproj( + xcodeproj: File.join(ios_dir, "PocketPal.xcodeproj") + ) + end + + UI.message("Bumped versions:") + UI.message("- Version name: #{new_version}") + UI.message("- Android version code: #{new_version_code}") + UI.message("- iOS build number: #{get_build_number_from_xcodeproj(xcodeproj: File.join(ios_dir, 'PocketPal.xcodeproj'))}") +end diff --git a/ios/PocketPal.xcodeproj/project.pbxproj b/ios/PocketPal.xcodeproj/project.pbxproj index 9bfa95a..3eeee27 100644 --- a/ios/PocketPal.xcodeproj/project.pbxproj +++ b/ios/PocketPal.xcodeproj/project.pbxproj @@ -425,6 +425,7 @@ baseConfigurationReference = 12009917F81D5194B51E7253 /* Pods-PocketPal-PocketPalTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 31; DEVELOPMENT_TEAM = MYXGXY23Y6; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -437,6 +438,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MARKETING_VERSION = 1.5.20; OTHER_LDFLAGS = ( "-ObjC", "-lc++", @@ -454,6 +456,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 31; DEVELOPMENT_TEAM = MYXGXY23Y6; INFOPLIST_FILE = PocketPalTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.4; @@ -462,6 +465,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MARKETING_VERSION = 1.5.20; OTHER_LDFLAGS = ( "-ObjC", "-lc++", @@ -479,8 +483,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 16; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; + CODE_SIGN_STYLE = Manual; + CURRENT_PROJECT_VERSION = 31; DEVELOPMENT_TEAM = MYXGXY23Y6; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = MYXGXY23Y6; ENABLE_BITCODE = NO; INFOPLIST_FILE = PocketPal/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; @@ -488,7 +495,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.5.2; + MARKETING_VERSION = 1.5.20; OTHER_CPLUSPLUSFLAGS = ( "$(OTHER_CFLAGS)", "-DFOLLY_NO_CONFIG", @@ -504,6 +511,8 @@ ); PRODUCT_BUNDLE_IDENTIFIER = ai.pocketpal; PRODUCT_NAME = PocketPal; + PROVISIONING_PROFILE_SPECIFIER = "match Development ai.pocketpal"; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match Development ai.pocketpal"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; @@ -521,15 +530,18 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 16; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Distribution"; + CODE_SIGN_STYLE = Manual; + CURRENT_PROJECT_VERSION = 31; DEVELOPMENT_TEAM = MYXGXY23Y6; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = MYXGXY23Y6; INFOPLIST_FILE = PocketPal/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.5.2; + MARKETING_VERSION = 1.5.20; OTHER_CPLUSPLUSFLAGS = ( "$(OTHER_CFLAGS)", "-DFOLLY_NO_CONFIG", @@ -545,6 +557,8 @@ ); PRODUCT_BUNDLE_IDENTIFIER = ai.pocketpal; PRODUCT_NAME = PocketPal; + PROVISIONING_PROFILE_SPECIFIER = "match AppStore ai.pocketpal"; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore ai.pocketpal"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; @@ -584,8 +598,10 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; + CODE_SIGN_STYLE = Manual; COPY_PHASE_STRIP = NO; + DEVELOPMENT_TEAM = MYXGXY23Y6; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; @@ -624,7 +640,10 @@ "-DFOLLY_USE_LIBCPP=1", "-DFOLLY_CFG_NO_COROUTINES=1", ); - OTHER_LDFLAGS = "$(inherited) "; + OTHER_LDFLAGS = ( + "$(inherited)", + " ", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; USE_HERMES = true; @@ -660,8 +679,11 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_IDENTITY = "Apple Distribution"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Distribution"; + CODE_SIGN_STYLE = Manual; COPY_PHASE_STRIP = YES; + DEVELOPMENT_TEAM = MYXGXY23Y6; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; @@ -692,7 +714,10 @@ "-DFOLLY_USE_LIBCPP=1", "-DFOLLY_CFG_NO_COROUTINES=1", ); - OTHER_LDFLAGS = "$(inherited) "; + OTHER_LDFLAGS = ( + "$(inherited)", + " ", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; USE_HERMES = true; diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile new file mode 100644 index 0000000..431c6ca --- /dev/null +++ b/ios/fastlane/Fastfile @@ -0,0 +1,59 @@ +default_platform :ios + +platform :ios do + desc "Release iOS app to TestFlight" + lane :release_ios do + setup_ci(force: true) + + api_key = app_store_connect_api_key( + key_id: ENV['APP_STORE_CONNECT_API_KEY_ID'], + issuer_id: ENV['APP_STORE_CONNECT_API_ISSUER_ID'], + key_content: ENV['APP_STORE_CONNECT_API_KEY_CONTENT'].gsub('\\n', "\n"), + in_house: false + ) + + # Helper method to encode GitHub token + def encoded_github_token + require 'base64' + Base64.strict_encode64("x-access-token:#{ENV['MATCH_GITHUB_TOKEN']}") + end + + match( + type: "development", + readonly: true, + api_key: api_key, + git_branch: "master", + git_basic_authorization: encoded_github_token + ) + + match( + type: "appstore", + readonly: true, + api_key: api_key, + git_branch: "master", + #password: ENV['MATCH_PASSWORD'], # will be picked up from environment variables + git_basic_authorization: encoded_github_token + ) + + build_ios_app( + scheme: "PocketPal", + export_method: "app-store", + output_directory: "./build", + clean: true, + export_options: { + provisioningProfiles: { + "ai.pocketpal" => "match AppStore ai.pocketpal" + }, + signingStyle: "manual" + } + ) + + upload_to_testflight( + api_key: api_key, + skip_waiting_for_build_processing: false, + wait_processing_interval: 60, # Check every minute + wait_for_uploaded_build: true, + wait_processing_timeout_duration: 1800 # 30 minutes timeout + ) + end +end diff --git a/ios/fastlane/Matchfile b/ios/fastlane/Matchfile new file mode 100644 index 0000000..d59eb90 --- /dev/null +++ b/ios/fastlane/Matchfile @@ -0,0 +1,17 @@ +git_url(ENV['MATCH_GIT_URL']) +git_basic_authorization(ENV['MATCH_GITHUB_TOKEN']) + +storage_mode("git") + +type("appstore") # The default type, can be: appstore, adhoc, enterprise or development + +app_identifier(["ai.pocketpal"]) +username(ENV['APP_STORE_CONNECT_USER_ID']) + +# app_identifier(["tools.fastlane.app", "tools.fastlane.app2"]) +# username("user@fastlane.tools") # Your Apple Developer Portal username + +# For all available options run `fastlane match --help` +# Remove the # in the beginning of the line to enable the other options + +# The docs are available on https://docs.fastlane.tools/actions/match diff --git a/package.json b/package.json index 2b1253e..d31defc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "PocketPal", - "version": "1.5.2", + "version": "1.5.20", "private": true, "scripts": { "prepare": "husky",