Skip to content

Instantly share code, notes, and snippets.

@Mastersam07
Created September 23, 2024 07:28
Show Gist options
  • Save Mastersam07/0eeee0dfa690855477796d9261c9c7eb to your computer and use it in GitHub Desktop.
Save Mastersam07/0eeee0dfa690855477796d9261c9c7eb to your computer and use it in GitHub Desktop.
somegist.sh
#!/bin/bash
# Function to find the DSYM file
find_dsym() {
find "$CI_DERIVED_DATA_PATH" -name "*.dSYM" | head -1
}
# Function to determine the current flavor
get_flavor() {
if [[ "$CI_WORKFLOW_NAME" == *"Development"* ]]; then
echo "development"
GOOGLE_SERVICE_INFO_PLIST="$CI_WORKSPACE/ios/Runner/Config/Google-Service-Info-Dev.plist"
elif [[ "$CI_WORKFLOW_NAME" == *"Staging"* ]]; then
echo "staging"
GOOGLE_SERVICE_INFO_PLIST="$CI_WORKSPACE/ios/Runner/Config/Google-Service-Info-Staging.plist"
elif [[ "$CI_WORKFLOW_NAME" == *"Production"* ]]; then
echo "production"
GOOGLE_SERVICE_INFO_PLIST="$CI_WORKSPACE/ios/Runner/Config/Google-Service-Info.plist"
else
echo "unknown"
fi
}
# Find the DSYM file
DSYM_PATH=$(find_dsym)
if [ -z "$DSYM_PATH" ]; then
echo "No dSYM found"
exit 1
fi
# Get the current flavor
FLAVOR=$(get_flavor)
if [ "$FLAVOR" == "unknown" ]; then
echo "Unable to determine flavor from workflow name"
exit 1
fi
if [ ! -f "$GOOGLE_SERVICE_INFO_PLIST" ]; then
echo "GoogleService-Info.plist not found for flavor: $FLAVOR"
exit 1
fi
# Upload DSYM to Crashlytics
echo "Uploading dSYM for flavor: $FLAVOR"
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "$GOOGLE_SERVICE_INFO_PLIST" -p ios "$DSYM_PATH"
if [ $? -eq 0 ]; then
echo "Successfully uploaded dSYM for $FLAVOR"
else
echo "Failed to upload dSYM for $FLAVOR"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment