Created
June 12, 2020 12:21
-
-
Save jorgemasta/499f5748122b6ee5c4a101aa010ff158 to your computer and use it in GitHub Desktop.
Automatically upload react-native source maps to Bugsnag from Appcenter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I just trying to connect appcenter with bugsnag. Any ideas?