diff --git a/.github/workflows/ios_deploy_production_to_testflight.yml b/.github/workflows/ios_deploy_production_to_testflight.yml new file mode 100644 index 0000000..52273ce --- /dev/null +++ b/.github/workflows/ios_deploy_production_to_testflight.yml @@ -0,0 +1,69 @@ +name: iOS - Deploy Production build to TestFlight +on: + push: + branches: + - main + +jobs: + build_and_upload_production_to_testflight: + name: Build and upload iOS Production build to TestFlight + runs-on: macOS-latest + steps: + - name: Check out + uses: actions/checkout@v3 + + - name: Install SSH key + uses: webfactory/ssh-agent@v0.8.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Set up Flutter environment + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.10.5' + - run: flutter --version + + - name: Set up deployment environment + env: + ENV_STAGING: ${{ secrets.ENV_PRODUCTION }} + run: echo "$ENV_PRODUCTION" > .env + + - name: Get Flutter dependencies + run: flutter pub get + + - name: Run code generator + run: flutter packages pub run build_runner build --delete-conflicting-outputs + + - name: Cache Ruby gems + uses: actions/cache@v3 + id: bunlderCache + with: + path: ios/vendor/bundle + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: ${{ runner.os }}-gems- + + - name: Cache Pods + uses: actions/cache@v3 + id: cocoapodCache + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: ${{ runner.os }}-pods- + + - name: Install iOS dependencies + run: cd ios && bundle install --path vendor/bundle && bundle exec pod install + + - name: Sync certificates and profiles + env: + MATCH_PASSWORD: ${{ secrets.MATCH_PASSPHRASE }} + run: cd ios && bundle exec fastlane sync_appstore_production_signing + + - name: Build and Deploy to TestFlight + env: + BUILD_NUMBER: ${{ github.run_number }} + TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + APPSTORE_CONNECT_API_KEY_ID: ${{ secrets.APPSTORE_CONNECT_API_KEY_ID }} + APPSTORE_CONNECT_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_ISSUER_ID }} + APPSTORE_CONNECT_API_KEY_CONTENT: ${{ secrets.APPSTORE_CONNECT_API_KEY_CONTENT }} + run: cd ios && bundle exec fastlane build_and_upload_production_to_testflight diff --git a/.github/workflows/ios_deploy_to_app_store.yml b/.github/workflows/ios_deploy_to_app_store.yml deleted file mode 100644 index e3de4a9..0000000 --- a/.github/workflows/ios_deploy_to_app_store.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: ios-deploy-to-app-store -on: - # Trigger the workflow on push action - push: - branches: - - develop - -jobs: - build_and_upload_to_app_store: - name: Build And Upload iOS Application To AppStore - runs-on: macOS-latest - timeout-minutes: 30 - env: - TEAM_ID: ${{ secrets.TEAM_ID }} - FASTLANE_USER: ${{ secrets.FASTLANE_USER }} - FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }} - FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }} - FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }} - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} - steps: - - name: Check out - uses: actions/checkout@v3 - - - name: Install SSH key - uses: webfactory/ssh-agent@v0.4.1 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - - name: Set up Flutter environment - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.10.5' - - - name: Get Flutter dependencies - run: flutter pub get - - - name: Run code generator - run: flutter packages pub run build_runner build --delete-conflicting-outputs - - - name: Bundle install - run: cd ./ios && bundle install - - - name: Pod install - run: cd ./ios && pod install - - - name: Match AppStore - run: cd ./ios && bundle exec fastlane sync_appstore_staging_signing - - - name: Deploy to AppStore - run: | - cd ./ios && bundle exec fastlane build_and_upload_app_store_connect_app diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index f18c93c..f03576d 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -38,6 +38,11 @@ platform :ios do match_manager.sync_app_store_signing(app_identifier: [Constants.BUNDLE_ID_STAGING]) end + desc 'Sync AppStore Production match signing' + lane :sync_appstore_production_signing do + match_manager.sync_app_store_signing(app_identifier: [Constants.BUNDLE_ID_PRODUCTION]) + end + desc 'Sync Adhoc Staging match signing' lane :sync_adhoc_staging_signing do match_manager.sync_adhoc_signing(app_identifier: [Constants.BUNDLE_ID_STAGING]) @@ -72,6 +77,23 @@ platform :ios do ) end + desc 'Build and upload Production app to Test Flight' + lane :build_and_upload_production_to_testflight do + set_app_version + bump_build + builder.build_app_store( + Constants.SCHEME_NAME_PRODUCTION, + Constants.PRODUCT_NAME_PRODUCTION, + Constants.BUNDLE_ID_PRODUCTION, + false + ) + set_appstore_connect_api_key + distribution_manager.upload_to_testflight( + product_name: Constants.PRODUCT_NAME_PRODUCTION, + bundle_identifier: Constants.BUNDLE_ID_PRODUCTION + ) + end + # AppStore desc 'Build and upload Staging app to App Store Connect'