Skip to content

Commit

Permalink
Merge pull request #43999 from margelo/fix/uploading-source-maps-ios
Browse files Browse the repository at this point in the history
fix: CI upload source maps when deploying a new app version
  • Loading branch information
roryabraham authored Jun 19, 2024
2 parents cf0e8a3 + c2ff42f commit e033314
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/platformDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ jobs:
- name: Archive Android sourcemaps
uses: actions/upload-artifact@v3
with:
name: android-sourcemap
path: android/app/build/generated/sourcemaps/react/release/*.map
name: android-sourcemap-${{ github.ref_name }}
path: android/app/build/generated/sourcemaps/react/productionRelease/index.android.bundle.map

- name: Upload Android version to GitHub artifacts
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
Expand Down Expand Up @@ -248,7 +248,7 @@ jobs:
- name: Archive iOS sourcemaps
uses: actions/upload-artifact@v3
with:
name: ios-sourcemap
name: ios-sourcemap-${{ github.ref_name }}
path: main.jsbundle.map

- name: Upload iOS version to GitHub artifacts
Expand Down
5 changes: 5 additions & 0 deletions ios/.xcode.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
# For example, to use nvm with brew, add the following line
# . "$(brew --prefix nvm)/nvm.sh" --no-use
export NODE_BINARY=$(command -v node)

# Provide a sourcemap path so that in release builds a source map file will be
# created at the specified location.
# (RN's default behaviour on iOS is to skip creating a sourcemap file):
export SOURCEMAP_FILE="$(pwd)/../main.jsbundle.map";
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/node_modules/react-native/scripts/react-native-xcode.sh b/node_modules/react-native/scripts/react-native-xcode.sh
index d6c382b..3e1742c 100755
--- a/node_modules/react-native/scripts/react-native-xcode.sh
+++ b/node_modules/react-native/scripts/react-native-xcode.sh
@@ -104,7 +104,7 @@ fi

BUNDLE_FILE="$CONFIGURATION_BUILD_DIR/main.jsbundle"

-EXTRA_ARGS=
+EXTRA_ARGS=()

case "$PLATFORM_NAME" in
"macosx")
@@ -131,12 +131,12 @@ if [[ $EMIT_SOURCEMAP == true ]]; then
else
PACKAGER_SOURCEMAP_FILE="$SOURCEMAP_FILE"
fi
- EXTRA_ARGS="$EXTRA_ARGS --sourcemap-output $PACKAGER_SOURCEMAP_FILE"
+ EXTRA_ARGS+=("--sourcemap-output" "$PACKAGER_SOURCEMAP_FILE")
fi

# Hermes doesn't require JS minification.
if [[ $USE_HERMES != false && $DEV == false ]]; then
- EXTRA_ARGS="$EXTRA_ARGS --minify false"
+ EXTRA_ARGS+=("--minify" "false")
fi

"$NODE_BINARY" $NODE_ARGS "$CLI_PATH" $BUNDLE_COMMAND \
@@ -147,7 +147,7 @@ fi
--reset-cache \
--bundle-output "$BUNDLE_FILE" \
--assets-dest "$DEST" \
- $EXTRA_ARGS \
+ "${EXTRA_ARGS[@]}" \
$EXTRA_PACKAGER_ARGS

if [[ $USE_HERMES == false ]]; then
8 changes: 5 additions & 3 deletions workflow_tests/assertions/platformDeployAssertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ function assertAndroidJobExecuted(workflowResult: Step[], didExecute = true, isP
}
steps.push(
createStepAssertion('Archive Android sourcemaps', true, null, 'ANDROID', 'Archiving Android sourcemaps', [
{key: 'name', value: 'android-sourcemap'},
{key: 'path', value: 'android/app/build/generated/sourcemaps/react/release/*.map'},
// Note 1.2.3 comes from the ref name that we are on, which is the version we are deploying
{key: 'name', value: 'android-sourcemap-1.2.3'},
{key: 'path', value: 'android/app/build/generated/sourcemaps/react/productionRelease/index.android.bundle.map'},
]),
);
if (!isProduction) {
Expand Down Expand Up @@ -187,7 +188,8 @@ function assertIOSJobExecuted(workflowResult: Step[], didExecute = true, isProdu
}
steps.push(
createStepAssertion('Archive iOS sourcemaps', true, null, 'IOS', 'Archiving sourcemaps', [
{key: 'name', value: 'ios-sourcemap'},
// Note 1.2.3 comes from the ref name that we are on, which is the version we are deploying
{key: 'name', value: 'ios-sourcemap-1.2.3'},
{key: 'path', value: 'main.jsbundle.map'},
]),
);
Expand Down

0 comments on commit e033314

Please sign in to comment.