Skip to content

Instantly share code, notes, and snippets.

@jorgemasta
Created June 12, 2020 12:21
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jorgemasta/499f5748122b6ee5c4a101aa010ff158 to your computer and use it in GitHub Desktop.
Automatically upload react-native source maps to Bugsnag from Appcenter
#!/usr/bin/env bash
# Prevent send to bugsnag in not selected branches
if [ "$APPCENTER_BRANCH" != "production" ] && [ "$APPCENTER_BRANCH" != "qa" ] && [ "$APPCENTER_BRANCH" != "staging" ]
then
echo "This branch is not in the selected ones:" $APPCENTER_BRANCH
exit
fi
# Set platform
echo "Setting Platform..."
if [ -n "$APPCENTER_ANDROID_VARIANT" ];
then
PLATFORM='android'
else
PLATFORM='ios'
fi
echo "Platform:" $PLATFORM
## Create sourcemaps and bundle
echo "Generating Source Maps..."
npx react-native bundle \
--platform $PLATFORM \
--dev false \
--entry-file index.js \
--bundle-output release.bundle \
--sourcemap-output release.bundle.map
echo "Source Maps Generated..."
## Upload sourcemaps to Bugsnag
echo "Uploading Source Maps..."
curl --http1.1 https://upload.bugsnag.com/react-native-source-map \
-F apiKey=02abfc7cf2e05ed6e203dc5a2639fd46 \
-F $([ "$PLATFORM" == android ] && echo appVersionCode || echo appBundleVersion)=$APPCENTER_BUILD_ID \
-F dev=false \
-F platform=$PLATFORM \
-F sourceMap=@release.bundle.map \
-F bundle=@release.bundle \
-F projectRoot=`pwd`
echo "Source Maps Uploaded..."
@Darex1991
Copy link

Hi, I just trying to connect appcenter with bugsnag. Any ideas?
Screenshot 2023-09-29 at 14 06 21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment