|
| 1 | +name: Build ReactNativeDependencies for PR |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + |
| 6 | +jobs: |
| 7 | + prepare_workspace: |
| 8 | + name: Prepare workspace |
| 9 | + runs-on: macos-14 |
| 10 | + steps: |
| 11 | + - name: Checkout |
| 12 | + uses: actions/checkout@v4 |
| 13 | + - name: Setup toolchain |
| 14 | + uses: ./.github/actions/microsoft-setup-toolchain |
| 15 | + with: |
| 16 | + platform: macos |
| 17 | + node-version: '22' |
| 18 | + - name: Restore cache if present |
| 19 | + id: restore-rn-deps |
| 20 | + uses: actions/cache/restore@v4 |
| 21 | + with: |
| 22 | + path: packages/react-native/third-party/ |
| 23 | + key: v2-pr-rn-dependencies-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }} |
| 24 | + enableCrossOsArchive: true |
| 25 | + - name: Prepare Dependencies |
| 26 | + if: steps.restore-rn-deps.outputs.cache-hit != 'true' |
| 27 | + run: | |
| 28 | + node scripts/releases/prepare-ios-prebuilds.js -s |
| 29 | + - name: Generate Package.swift |
| 30 | + if: steps.restore-rn-deps.outputs.cache-hit != 'true' |
| 31 | + run: | |
| 32 | + node scripts/releases/prepare-ios-prebuilds.js -w |
| 33 | + - name: Upload Artifacts |
| 34 | + uses: actions/upload-artifact@v4.3.4 |
| 35 | + with: |
| 36 | + name: rn-deps-workspace |
| 37 | + path: packages/react-native/third-party/ |
| 38 | + - name: Save Cache |
| 39 | + uses: actions/cache/save@v4 |
| 40 | + if: ${{ github.ref == 'refs/heads/main' }} |
| 41 | + with: |
| 42 | + key: v2-pr-rn-dependencies-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }} |
| 43 | + enableCrossOsArchive: true |
| 44 | + path: packages/react-native/third-party/ |
| 45 | + |
| 46 | + build-macos-slice: |
| 47 | + name: Build macOS Slice |
| 48 | + runs-on: macos-14 |
| 49 | + needs: [prepare_workspace] |
| 50 | + strategy: |
| 51 | + fail-fast: false |
| 52 | + matrix: |
| 53 | + flavor: ['Debug', 'Release'] |
| 54 | + steps: |
| 55 | + - name: Checkout |
| 56 | + uses: actions/checkout@v4 |
| 57 | + - name: Setup toolchain |
| 58 | + uses: ./.github/actions/microsoft-setup-toolchain |
| 59 | + with: |
| 60 | + platform: macos |
| 61 | + node-version: '22' |
| 62 | + - name: Restore slice folder |
| 63 | + id: restore-slice-folder |
| 64 | + uses: actions/cache/restore@v4 |
| 65 | + with: |
| 66 | + path: packages/react-native/third-party/.build/Build/Products |
| 67 | + key: v2-pr-rn-dependencies-slice-macos-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }} |
| 68 | + - name: Restore workspace |
| 69 | + if: steps.restore-slice-folder.outputs.cache-hit != 'true' |
| 70 | + uses: actions/download-artifact@v4 |
| 71 | + with: |
| 72 | + name: rn-deps-workspace |
| 73 | + path: packages/react-native/third-party/ |
| 74 | + - name: Print third-party folder structure |
| 75 | + run: ls -lR packages/react-native/third-party |
| 76 | + - name: Build slice for macOS ${{ matrix.flavor }} |
| 77 | + if: steps.restore-slice-folder.outputs.cache-hit != 'true' |
| 78 | + run: node scripts/releases/prepare-ios-prebuilds.js -b -p macos -r ${{ matrix.flavor }} |
| 79 | + - name: Upload Artifacts |
| 80 | + uses: actions/upload-artifact@v4.3.4 |
| 81 | + with: |
| 82 | + name: prebuild-slice-${{ matrix.flavor }}-macos |
| 83 | + path: | |
| 84 | + packages/react-native/third-party/.build/Build/Products |
| 85 | + - name: Save Cache |
| 86 | + uses: actions/cache/save@v4 |
| 87 | + if: ${{ github.ref == 'refs/heads/main' }} |
| 88 | + with: |
| 89 | + key: v2-pr-rn-dependencies-slice-macos-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }} |
| 90 | + enableCrossOsArchive: true |
| 91 | + path: | |
| 92 | + packages/react-native/third-party/.build/Build/Products |
| 93 | +
|
| 94 | + create-xcframework: |
| 95 | + name: Create XCFramework |
| 96 | + runs-on: macos-14 |
| 97 | + needs: [build-macos-slice] |
| 98 | + strategy: |
| 99 | + fail-fast: false |
| 100 | + matrix: |
| 101 | + flavor: [Debug, Release] |
| 102 | + steps: |
| 103 | + - name: Checkout |
| 104 | + uses: actions/checkout@v4 |
| 105 | + - name: Setup toolchain |
| 106 | + uses: ./.github/actions/microsoft-setup-toolchain |
| 107 | + with: |
| 108 | + platform: macos |
| 109 | + node-version: '22' |
| 110 | + - name: Restore XCFramework |
| 111 | + id: restore-xcframework |
| 112 | + uses: actions/cache/restore@v4 |
| 113 | + with: |
| 114 | + path: | |
| 115 | + packages/react-native/third-party/ |
| 116 | + key: v2-pr-rn-dependencies-xcframework-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }} |
| 117 | + - name: Restore workspace |
| 118 | + if: steps.restore-xcframework.outputs.cache-hit != 'true' |
| 119 | + uses: actions/download-artifact@v4 |
| 120 | + with: |
| 121 | + name: rn-deps-workspace |
| 122 | + path: packages/react-native/third-party/ |
| 123 | + - name: Download slices |
| 124 | + if: steps.restore-xcframework.outputs.cache-hit != 'true' |
| 125 | + uses: actions/download-artifact@v4 |
| 126 | + with: |
| 127 | + pattern: prebuild-slice-${{ matrix.flavor }}-* |
| 128 | + path: packages/react-native/third-party/.build/Build/Products |
| 129 | + merge-multiple: true |
| 130 | + - name: Create XCFramework (unsigned) |
| 131 | + if: steps.restore-xcframework.outputs.cache-hit != 'true' |
| 132 | + run: node scripts/releases/prepare-ios-prebuilds.js -c -r ${{ matrix.flavor }} |
| 133 | + - name: Compress and Rename XCFramework |
| 134 | + if: steps.restore-xcframework.outputs.cache-hit != 'true' |
| 135 | + run: | |
| 136 | + tar -cz -f packages/react-native/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz \ |
| 137 | + packages/react-native/third-party/ReactNativeDependencies.xcframework |
| 138 | + - name: Upload XCFramework Artifact |
| 139 | + uses: actions/upload-artifact@v4 |
| 140 | + with: |
| 141 | + name: ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz |
| 142 | + path: packages/react-native/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz |
| 143 | + - name: Save XCFramework in Cache |
| 144 | + if: ${{ github.ref == 'refs/heads/main' }} |
| 145 | + uses: actions/cache/save@v4 |
| 146 | + with: |
| 147 | + path: | |
| 148 | + packages/react-native/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz |
| 149 | + key: v2-pr-rn-dependencies-xcframework-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }} |
0 commit comments