|
| 1 | +name: Build example apps |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - '**' |
| 9 | + - '!docs/**' |
| 10 | + - '!**/*.md' |
| 11 | + - '!**/__tests__/**' |
| 12 | + - '!jest/**' |
| 13 | + - '!.github/workflows/**' |
| 14 | + - '.github/workflows/build-example-apps.yml' |
| 15 | + pull_request: |
| 16 | + paths: |
| 17 | + - '**' |
| 18 | + - '!docs/**' |
| 19 | + - '!**/*.md' |
| 20 | + - '!**/__tests__/**' |
| 21 | + - '!jest/**' |
| 22 | + - '!.github/workflows/**' |
| 23 | + - '.github/workflows/build-example-apps.yml' |
| 24 | + workflow_dispatch: |
| 25 | + |
| 26 | +permissions: |
| 27 | + contents: read |
| 28 | + |
| 29 | +concurrency: |
| 30 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 31 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 32 | + |
| 33 | +jobs: |
| 34 | + build-android: |
| 35 | + name: Build Android |
| 36 | + runs-on: ubuntu-latest |
| 37 | + timeout-minutes: 60 |
| 38 | + steps: |
| 39 | + - name: Checkout |
| 40 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 41 | + |
| 42 | + - name: Setup |
| 43 | + uses: ./.github/actions/setup |
| 44 | + |
| 45 | + - name: Calculate fingerprint |
| 46 | + id: fingerprint |
| 47 | + working-directory: example |
| 48 | + run: | |
| 49 | + fingerprint=$(yarn expo-updates fingerprint:generate --platform android | jq -er .hash) |
| 50 | + echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT" |
| 51 | +
|
| 52 | + - name: Cache release build |
| 53 | + id: cache |
| 54 | + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 |
| 55 | + with: |
| 56 | + path: react-native-paper-example.apk |
| 57 | + key: android-${{ steps.fingerprint.outputs.fingerprint }}-${{ hashFiles('.github/workflows/build-example-apps.yml') }} |
| 58 | + |
| 59 | + - name: Setup JDK |
| 60 | + uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 |
| 61 | + with: |
| 62 | + distribution: temurin |
| 63 | + java-version: 17 |
| 64 | + |
| 65 | + - name: Build Android app |
| 66 | + if: steps.cache.outputs.cache-hit != 'true' |
| 67 | + working-directory: example |
| 68 | + run: | |
| 69 | + yarn expo prebuild --platform android --no-install |
| 70 | + cd android |
| 71 | + ./gradlew :app:assembleRelease -Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=1g -PreactNativeArchitectures=arm64-v8a,x86_64 |
| 72 | + mv app/build/outputs/apk/release/app-release.apk ../../react-native-paper-example.apk |
| 73 | +
|
| 74 | + - name: Repack cached build |
| 75 | + if: steps.cache.outputs.cache-hit == 'true' |
| 76 | + working-directory: example |
| 77 | + run: | |
| 78 | + yarn dlx @expo/repack-app@0.10.3 \ |
| 79 | + --platform android \ |
| 80 | + --source-app ../react-native-paper-example.apk \ |
| 81 | + --output ../react-native-paper-example.apk |
| 82 | +
|
| 83 | + - name: Upload APK |
| 84 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 85 | + with: |
| 86 | + path: react-native-paper-example.apk |
| 87 | + archive: false |
| 88 | + retention-days: 30 |
| 89 | + |
| 90 | + build-ios: |
| 91 | + name: Build iOS |
| 92 | + runs-on: macos-latest |
| 93 | + timeout-minutes: 60 |
| 94 | + steps: |
| 95 | + - name: Checkout |
| 96 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 97 | + |
| 98 | + - name: Setup |
| 99 | + uses: ./.github/actions/setup |
| 100 | + |
| 101 | + - name: Calculate fingerprint |
| 102 | + id: fingerprint |
| 103 | + working-directory: example |
| 104 | + run: | |
| 105 | + fingerprint=$(yarn expo-updates fingerprint:generate --platform ios | jq -er .hash) |
| 106 | + echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT" |
| 107 | +
|
| 108 | + - name: Cache release build |
| 109 | + id: cache |
| 110 | + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 |
| 111 | + with: |
| 112 | + path: react-native-paper-example.app |
| 113 | + key: ios-${{ steps.fingerprint.outputs.fingerprint }}-${{ hashFiles('.github/workflows/build-example-apps.yml') }} |
| 114 | + |
| 115 | + - name: Build iOS app |
| 116 | + if: steps.cache.outputs.cache-hit != 'true' |
| 117 | + working-directory: example |
| 118 | + run: | |
| 119 | + yarn expo prebuild --platform ios --no-install |
| 120 | + cd ios |
| 121 | + pod install |
| 122 | + xcodebuild build \ |
| 123 | + -workspace ReactNativePaperExample.xcworkspace \ |
| 124 | + -scheme ReactNativePaperExample \ |
| 125 | + -configuration Release \ |
| 126 | + -destination 'generic/platform=iOS Simulator' \ |
| 127 | + -derivedDataPath build \ |
| 128 | + ARCHS=arm64 |
| 129 | + mv build/Build/Products/Release-iphonesimulator/ReactNativePaperExample.app ../../react-native-paper-example.app |
| 130 | +
|
| 131 | + - name: Repack cached build |
| 132 | + if: steps.cache.outputs.cache-hit == 'true' |
| 133 | + working-directory: example |
| 134 | + run: | |
| 135 | + mv ../react-native-paper-example.app "$RUNNER_TEMP/cached.app" |
| 136 | + yarn dlx @expo/repack-app@0.10.3 \ |
| 137 | + --platform ios \ |
| 138 | + --source-app "$RUNNER_TEMP/cached.app" \ |
| 139 | + --output ../react-native-paper-example.app |
| 140 | +
|
| 141 | + - name: Archive app |
| 142 | + run: ditto -c -k --keepParent react-native-paper-example.app react-native-paper-example.app.zip |
| 143 | + |
| 144 | + - name: Upload app |
| 145 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 146 | + with: |
| 147 | + path: react-native-paper-example.app.zip |
| 148 | + archive: false |
| 149 | + retention-days: 30 |
0 commit comments