|
| 1 | +name: iOS Build and upload to testflight |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: macos-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Checkout repository |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Setup Node.js |
| 18 | + uses: actions/setup-node@v4 |
| 19 | + with: |
| 20 | + node-version-file: "frontend/package.json" |
| 21 | + |
| 22 | + - name: Setup Xcode |
| 23 | + uses: maxim-lobanov/setup-xcode@v1 |
| 24 | + with: |
| 25 | + xcode-version: '16.2' |
| 26 | + |
| 27 | + - name: Install Bundler |
| 28 | + run: gem install bundler |
| 29 | + |
| 30 | + - name: Create .env file |
| 31 | + working-directory: frontend |
| 32 | + run: | |
| 33 | + echo "VITE_BUILD_DATE=1970-01-01 |
| 34 | + VITE_BUILD_TIME=00:00:00 |
| 35 | + VITE_BUILD_TS=1970-01-01T00:00:00+0000 |
| 36 | + VITE_BUILD_COMMIT_SHA=test |
| 37 | + VITE_BUILD_ENV_CODE=test |
| 38 | + VITE_BUILD_WORKFLOW_RUNNER=test |
| 39 | + VITE_BUILD_WORKFLOW_NAME=test |
| 40 | + VITE_BUILD_WORKFLOW_RUN_NUMBER=1 |
| 41 | + VITE_BUILD_WORKFLOW_RUN_ATTEMPT=1 |
| 42 | + VITE_BASE_URL_API=https://jsonplaceholder.typicode.com |
| 43 | + VITE_TOAST_AUTO_DISMISS_MILLIS=1500" > .env |
| 44 | +
|
| 45 | + - name: Install dependencies |
| 46 | + working-directory: frontend |
| 47 | + run: npm ci |
| 48 | + |
| 49 | + - name: Build Ionic |
| 50 | + working-directory: frontend |
| 51 | + run: npm run build |
| 52 | + |
| 53 | + - name: Prepare Capacitor for iOS |
| 54 | + working-directory: frontend |
| 55 | + run: | |
| 56 | + npx cap sync ios |
| 57 | + npx cap copy ios |
| 58 | +
|
| 59 | + - name: Install CocoaPods |
| 60 | + working-directory: frontend/ios/App |
| 61 | + run: pod install --verbose |
| 62 | + |
| 63 | + - name: Install Fastlane |
| 64 | + working-directory: frontend/ios/App |
| 65 | + run: gem install fastlane |
| 66 | + |
| 67 | + - name: Setup SSH for Fastlane Match Repo Access |
| 68 | + run: | |
| 69 | + mkdir -p ~/.ssh |
| 70 | + echo "${{ secrets.IOS_SIGNING_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa |
| 71 | + chmod 600 ~/.ssh/id_rsa |
| 72 | + ssh-keyscan github.com >> ~/.ssh/known_hosts |
| 73 | +
|
| 74 | + - name: Decode App Store API Key |
| 75 | + working-directory: frontend/ios/App |
| 76 | + env: |
| 77 | + IOS_API_KEY_JSON: ${{ secrets.IOS_API_KEY_JSON }} |
| 78 | + run: echo "$IOS_API_KEY_JSON" > /tmp/api-key.json |
| 79 | + |
| 80 | + - name: Set up Fastlane Match Password |
| 81 | + run: echo "MATCH_PASSWORD=${{ secrets.FASTLANE_MATCH_PASSWORD }}" >> $GITHUB_ENV |
| 82 | + |
| 83 | + - name: Build iOS App for Simulator |
| 84 | + working-directory: frontend/ios/App |
| 85 | + env: |
| 86 | + NSUnbufferedIO: "YES" |
| 87 | + FASTLANE_VERBOSE: "1" |
| 88 | + run: | |
| 89 | + bundle install |
| 90 | + bundle exec fastlane ios build_for_simulator --verbose |
| 91 | +
|
| 92 | + - name: Upload App.app (iOS Simulator File) |
| 93 | + uses: actions/upload-artifact@v4 |
| 94 | + with: |
| 95 | + name: build_for_simulator |
| 96 | + path: frontend/ios/App/build/simulator/App.xcarchive/Products/Applications/ |
| 97 | + retention-days: 7 |
| 98 | + |
| 99 | + - name: Build iOS App for testflight. |
| 100 | + working-directory: frontend/ios/App |
| 101 | + env: |
| 102 | + NSUnbufferedIO: "YES" |
| 103 | + FASTLANE_VERBOSE: "1" |
| 104 | + FASTLANE_MATCH_PASSWORD: ${{ secrets.FASTLANE_MATCH_PASSWORD }} |
| 105 | + run: | |
| 106 | + bundle install |
| 107 | + bundle exec fastlane ios build_and_send_to_testflight --verbose |
| 108 | +
|
| 109 | + - name: Upload App.ipa (iOS device installation) |
| 110 | + uses: actions/upload-artifact@v4 |
| 111 | + with: |
| 112 | + name: build_for_device |
| 113 | + path: frontend/ios/App/build/device/App.ipa |
| 114 | + retention-days: 7 |
0 commit comments