Skip to content

Commit

Permalink
fix(build): fix rnx-build-apple not being resolved (#3168)
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 authored May 30, 2024
1 parent dddf041 commit 0f4868a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-donuts-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rnx-kit/build": patch
---

Fix `rnx-build-apple` not being resolved correctly in pnpm setups
12 changes: 6 additions & 6 deletions .github/workflows/rnx-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,21 @@ jobs:
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
run: npx --prefix . rnx-build-apple install-certificate
run: /bin/bash $(node --print 'require.resolve("@rnx-kit/build/scripts/build-apple")') install-certificate
- name: Build iOS app
run: npx --prefix . rnx-build-apple build-ios --scheme ${{ github.event.inputs.scheme }} --device-type ${{ github.event.inputs.deviceType }} --archs ${{ github.event.inputs.architecture }}
run: /bin/bash $(node --print 'require.resolve("@rnx-kit/build/scripts/build-apple")') build-ios --scheme ${{ github.event.inputs.scheme }} --device-type ${{ github.event.inputs.deviceType }} --archs ${{ github.event.inputs.architecture }}
working-directory: ${{ github.event.inputs.projectRoot }}/ios
- name: Remove Apple signing certificate and provisioning profile
# Always run this job step, even if previous ones fail. See also
# https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development#required-clean-up-on-self-hosted-runners
if: ${{ always() && github.event.inputs.deviceType == 'device' }}
run: npx --prefix . rnx-build-apple uninstall-certificate
run: /bin/bash $(node --print 'require.resolve("@rnx-kit/build/scripts/build-apple")') uninstall-certificate
- name: Prepare build artifact
id: prepare-build-artifact
run: |
if [[ ${{ github.event.inputs.distribution }} == 'local' ]]; then
app=$(find ${XCARCHIVE_FILE}/Products/Applications -maxdepth 1 -name '*.app' -type d | head -1)
npx --prefix . rnx-build-apple archive ios-artifact.tar "${app}"
/bin/bash $(node --print 'require.resolve("@rnx-kit/build/scripts/build-apple")') archive ios-artifact.tar "${app}"
echo 'filename=ios-artifact.tar' >> $GITHUB_OUTPUT
else
xcodebuild -exportArchive -archivePath ${XCARCHIVE_FILE} -exportPath export -exportOptionsPlist ExportOptions.plist 2>&1
Expand Down Expand Up @@ -131,13 +131,13 @@ jobs:
run: pod install --project-directory=macos --verbose
working-directory: ${{ github.event.inputs.projectRoot }}
- name: Build macOS app
run: npx --prefix . rnx-build-apple build-macos --scheme ${{ github.event.inputs.scheme }}
run: /bin/bash $(node --print 'require.resolve("@rnx-kit/build/scripts/build-apple")') build-macos --scheme ${{ github.event.inputs.scheme }}
working-directory: ${{ github.event.inputs.projectRoot }}/macos
- name: Prepare build artifact
run: |
output_path=DerivedData/Build/Products
app=$(find ${output_path} -maxdepth 2 -name '*.app' -type d | head -1)
npx --prefix . rnx-build-apple archive macos-artifact.tar "${app}"
/bin/bash $(node --print 'require.resolve("@rnx-kit/build/scripts/build-apple")') archive macos-artifact.tar "${app}"
working-directory: ${{ github.event.inputs.projectRoot }}/macos
- name: Upload build artifact
uses: actions/upload-artifact@v4
Expand Down
3 changes: 3 additions & 0 deletions incubator/build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"types": "./lib/index.d.ts",
"import": "./lib/index.js"
},
"./scripts/build-apple": {
"require": "./scripts/build-apple.sh"
},
"./package.json": "./package.json"
},
"bin": {
Expand Down
12 changes: 6 additions & 6 deletions incubator/build/workflows/github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,21 @@ jobs:
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
run: npx --prefix . rnx-build-apple install-certificate
run: /bin/bash $(node --print 'require.resolve("@rnx-kit/build/scripts/build-apple")') install-certificate
- name: Build iOS app
run: npx --prefix . rnx-build-apple build-ios --scheme ${{ github.event.inputs.scheme }} --device-type ${{ github.event.inputs.deviceType }} --archs ${{ github.event.inputs.architecture }}
run: /bin/bash $(node --print 'require.resolve("@rnx-kit/build/scripts/build-apple")') build-ios --scheme ${{ github.event.inputs.scheme }} --device-type ${{ github.event.inputs.deviceType }} --archs ${{ github.event.inputs.architecture }}
working-directory: ${{ github.event.inputs.projectRoot }}/ios
- name: Remove Apple signing certificate and provisioning profile
# Always run this job step, even if previous ones fail. See also
# https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development#required-clean-up-on-self-hosted-runners
if: ${{ always() && github.event.inputs.deviceType == 'device' }}
run: npx --prefix . rnx-build-apple uninstall-certificate
run: /bin/bash $(node --print 'require.resolve("@rnx-kit/build/scripts/build-apple")') uninstall-certificate
- name: Prepare build artifact
id: prepare-build-artifact
run: |
if [[ ${{ github.event.inputs.distribution }} == 'local' ]]; then
app=$(find ${XCARCHIVE_FILE}/Products/Applications -maxdepth 1 -name '*.app' -type d | head -1)
npx --prefix . rnx-build-apple archive ios-artifact.tar "${app}"
/bin/bash $(node --print 'require.resolve("@rnx-kit/build/scripts/build-apple")') archive ios-artifact.tar "${app}"
echo 'filename=ios-artifact.tar' >> $GITHUB_OUTPUT
else
xcodebuild -exportArchive -archivePath ${XCARCHIVE_FILE} -exportPath export -exportOptionsPlist ExportOptions.plist 2>&1
Expand Down Expand Up @@ -131,13 +131,13 @@ jobs:
run: pod install --project-directory=macos --verbose
working-directory: ${{ github.event.inputs.projectRoot }}
- name: Build macOS app
run: npx --prefix . rnx-build-apple build-macos --scheme ${{ github.event.inputs.scheme }}
run: /bin/bash $(node --print 'require.resolve("@rnx-kit/build/scripts/build-apple")') build-macos --scheme ${{ github.event.inputs.scheme }}
working-directory: ${{ github.event.inputs.projectRoot }}/macos
- name: Prepare build artifact
run: |
output_path=DerivedData/Build/Products
app=$(find ${output_path} -maxdepth 2 -name '*.app' -type d | head -1)
npx --prefix . rnx-build-apple archive macos-artifact.tar "${app}"
/bin/bash $(node --print 'require.resolve("@rnx-kit/build/scripts/build-apple")') archive macos-artifact.tar "${app}"
working-directory: ${{ github.event.inputs.projectRoot }}/macos
- name: Upload build artifact
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions packages/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@react-native/babel-preset": "^0.73.0",
"@react-native/metro-config": "^0.73.0",
"@rnx-kit/babel-preset-metro-react-native": "workspace:*",
"@rnx-kit/build": "workspace:*",
"@rnx-kit/cli": "workspace:*",
"@rnx-kit/eslint-config": "workspace:*",
"@rnx-kit/jest-preset": "workspace:*",
Expand Down
3 changes: 2 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3660,7 +3660,7 @@ __metadata:
languageName: unknown
linkType: soft

"@rnx-kit/build@npm:*, @rnx-kit/build@workspace:incubator/build":
"@rnx-kit/build@npm:*, @rnx-kit/build@workspace:*, @rnx-kit/build@workspace:incubator/build":
version: 0.0.0-use.local
resolution: "@rnx-kit/build@workspace:incubator/build"
dependencies:
Expand Down Expand Up @@ -4408,6 +4408,7 @@ __metadata:
"@react-native/babel-preset": "npm:^0.73.0"
"@react-native/metro-config": "npm:^0.73.0"
"@rnx-kit/babel-preset-metro-react-native": "workspace:*"
"@rnx-kit/build": "workspace:*"
"@rnx-kit/cli": "workspace:*"
"@rnx-kit/eslint-config": "workspace:*"
"@rnx-kit/jest-preset": "workspace:*"
Expand Down

0 comments on commit 0f4868a

Please sign in to comment.