diff --git a/.github/workflows/ios-release-testflight_local_bmvn.yaml b/.github/workflows/ios-release-testflight_local_bmvn.yaml new file mode 100644 index 000000000..d251ba6e5 --- /dev/null +++ b/.github/workflows/ios-release-testflight_local_bmvn.yaml @@ -0,0 +1,114 @@ +name: Deploy the iOS app to TestFlight in Local CI BMVN +on: + # Enable manual run + workflow_dispatch: + inputs: + version: + description: "App version" + required: true + message: + description: Change logs + required: false + +jobs: + fastlane-deploy: + runs-on: [self-hosted, macOS, X64, testflight] + steps: + # Set up Flutter. + - name: Clone Flutter repository with master channel + uses: subosito/flutter-action@v2 + with: + flutter-version: "3.22.1" + channel: stable + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: "15.2" + + - name: Set env + run: | + ${{ github.event.inputs.testnet == 'true' }} && echo FASTLAN_ENV=test >> $GITHUB_ENV || echo FASTLAN_ENV=main >> $GITHUB_ENV + + # Checkout code and get packages. + - name: Checkout code + uses: actions/checkout@v3 + + # Setup Ruby, Bundler, and Gemfile dependencies + - name: Setup Fastlane + uses: ruby/setup-ruby@v1 + with: + ruby-version: "2.6" + bundler-cache: true + working-directory: ios + + - uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: | + ${{ secrets.KEY_VAULT_DEPLOYMENT_KEY }} + ${{ secrets.SSH_ASSETS_KEY }} + + - name: Create env file + run: | + touch .env + echo -e "${{ secrets.PRODUCTION_ENV_VARS }}" | sed 's/\\n/\n/g' >> .env + cat .env + + - name: Create env secret file + run: | + touch .env.secret + echo -e "${{ secrets.PRODUCTION_ENV_SECRET }}" | sed 's/\\n/\n/g' >> .env.secret + cat .env.secret + + - name: Flutter doctor + run: flutter doctor + - name: Submoudles update + run: git -c submodule.auto-test.update=none submodule update --init --recursive + + # Precache to fix iOS pod install issue + - run: flutter precache --ios + + - name: cache pods + uses: actions/cache@v1 + with: + path: ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/ios/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + - name: pod install + if: steps.cache-cocoapods.outputs.cache-hit != 'true' + run: | + flutter pub cache repair + flutter clean + flutter pub get + cd ios/ + pod install + + # Encrypt secrets before use + - name: Encrypt Secrets + run: | + ./script/encrypt_secrets.sh ${{ secrets.ENTROPY }} + + - uses: mathieu-bour/setup-sentry-cli@main + + # Build and deploy with Fastlane (by default, to ciappcenter track) 🚀. + - name: Build and deploy with Fastlane + env: + ENTERPRISE_CERTIFICATE_PASSWORD: ${{ secrets.ENTERPRISE_CERTIFICATE_PASSWORD }} + APPSTORE_CERTIFICATE_PASSWORD: ${{ secrets.APPSTORE_CERTIFICATE_PASSWORD }} + JSON_FILE: ${{ secrets.JSON_FILE }} + SENTRY_AUTH: ${{ secrets.SENTRY_AUTH }} + APPCENTER_API_TOKEN: ${{ secrets.APPCENTER_API_TOKEN }} + TESTFLIGHT_KEY_ID: ${{ secrets.TESTFLIGHT_KEY_ID }} + TESTFLIGHT_ISSUER_ID: ${{ secrets.TESTFLIGHT_ISSUER_ID }} + TESTFLIGHT_API_TOKEN: ${{ secrets.TESTFLIGHT_API_TOKEN }} + APP_VERSION: ${{ github.event.inputs.version }} + BRANCH_KEY: ${{ secrets.BRANCH_KEY }} + RELEASE_NOTES: ${{ github.event.inputs.message }} + + run: | + git clone git@github.com:bitmark-inc/mobile-signing-key-vault.git --depth 1 + echo $JSON_FILE >> key.json + bundle exec fastlane install_plugins + echo "APP_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + bundle exec fastlane citestflight env:${{ env.FASTLAN_ENV }} + + working-directory: ios