Created
July 6, 2020 22:04
-
-
Save raulsilvamx/0896db047261797489fad29eddcafbd8 to your computer and use it in GitHub Desktop.
Firebase dSYMs uploader
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 zsh | |
################################# | |
# Firebase upload script dSYMs | |
# Version: 2020.07.06 | |
# | |
# Author: Raul Silva | |
# Email: [email protected] | |
# Created: 6-Jul-2020 | |
# Updated: 6-Jul-2020 | |
################################# | |
# path of script | |
MAIN_PATH=$PWD | |
#echo $MAIN_PATH | |
CURRENT_SCRIPT=${(%):-%x} | |
#echo $CURRENT_SCRIPT | |
# Help text to show | |
helpFunction() | |
{ | |
echo "" | |
echo "Usage: $CURRENT_SCRIPT -f \"/archive/path/App.xcarchive\" -e qa" | |
echo -e "\t-f - Archive full path of .xcarchive" | |
echo -e "\t-e - Environment of archive \"prod,qa,debug,local,staging\" " | |
exit 1 # Exit script after printing help | |
} | |
# Get arguments | |
while [ "$1" != "" ]; do | |
case $1 in | |
-f | -file) shift | |
ARCHIVE_FILENAME=$1 | |
;; | |
-e | -environment) shift | |
ENVIRONMENT=$1 | |
;; | |
-h | -help) helpFunction | |
;; | |
esac | |
shift | |
done | |
#echo $ARCHIVE_FILENAME | |
#echo $ENVIRONMENT | |
echo "" | |
# Print helpFunction in case parameters are empty | |
if [ -z "$ARCHIVE_FILENAME" ] || [ -z "$ENVIRONMENT" ] | |
then | |
echo "Error: Incomplete arguments"; | |
helpFunction | |
fi | |
# Search archive | |
if ! [ -d "$ARCHIVE_FILENAME" ]; then | |
echo "Error: It didn't find archive filename: $ARCHIVE_FILENAME"; | |
helpFunction | |
fi | |
ARCHIVE_FILENAME_DSYMS_PATH="$ARCHIVE_FILENAME/dSYMs" | |
if ! [ -d "$ARCHIVE_FILENAME_DSYMS_PATH" ]; then | |
echo "Error: It didn't find archive dSYMs: $ARCHIVE_FILENAME_DSYMS_PATH"; | |
helpFunction | |
fi | |
# Search upload-symbols executable | |
UPLOAD_SYMBOLS_EXECUTABLE="$MAIN_PATH/Pods/FirebaseCrashlytics/upload-symbols" | |
if ! [ -f "$UPLOAD_SYMBOLS_EXECUTABLE" ]; then | |
echo "Error: It didn't find upload-symbols: $UPLOAD_SYMBOLS_EXECUTABLE"; | |
helpFunction | |
fi | |
#echo $UPLOAD_SYMBOLS_EXECUTABLE | |
case $ENVIRONMENT in | |
prod) GOOGLESERVICE_INFO_FILE="GoogleService-Info.plist" | |
;; | |
qa) GOOGLESERVICE_INFO_FILE="GoogleService-Info-qa.plist" | |
;; | |
debug) GOOGLESERVICE_INFO_FILE="GoogleService-Info-debug.plist" | |
;; | |
staging) GOOGLESERVICE_INFO_FILE="GoogleService-Info-staging.plist" | |
;; | |
local) GOOGLESERVICE_INFO_FILE="GoogleService-Info-local.plist" | |
;; | |
esac | |
if [ -z "$GOOGLESERVICE_INFO_FILE" ] | |
then | |
echo "Error: It didn't find the correct environment: $ENVIRONMENT"; | |
helpFunction | |
fi | |
GOOGLESERVICE_INFO_FILE_PATH="$MAIN_PATH/App/$GOOGLESERVICE_INFO_FILE" | |
#echo $GOOGLESERVICE_INFO_FILE_PATH | |
# Search Google service info file | |
if ! [ -f "$GOOGLESERVICE_INFO_FILE_PATH" ]; then | |
echo "Error: It didn't find GoogleService-Info file: $GOOGLESERVICE_INFO_FILE_PATH"; | |
helpFunction | |
fi | |
#/path/to/pods/directory/FirebaseCrashlytics/upload-symbols -gsp /path/to/GoogleService-Info.plist -p ios /path/to/dSYMs | |
echo "$UPLOAD_SYMBOLS_EXECUTABLE -gsp $GOOGLESERVICE_INFO_FILE_PATH -p ios $ARCHIVE_FILENAME_DSYMS_PATH" | |
$UPLOAD_SYMBOLS_EXECUTABLE -gsp $GOOGLESERVICE_INFO_FILE_PATH -p ios $ARCHIVE_FILENAME_DSYMS_PATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment