Last active
April 21, 2017 05:29
-
-
Save aaccurso/fe0d347b292022eabeb92eebd89d1af5 to your computer and use it in GitHub Desktop.
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
# Check arguments | |
PROJECT_NAME=${1:-} | |
if [ -z $PROJECT_NAME ]; then echo "No project name provided!"; exit 1; fi | |
APPLICATION_APK=${2:-} | |
if [ ! -f $APPLICATION_APK ]; then echo "File does not exists or no file apk provided!"; exit 1; fi | |
# Configure gdrive CLI with permission file | |
GDRIVE="gdrive -c /home/${USER}/.gdrive" | |
# Get parent folder id of the relse folder to upload apk | |
PROJECT_FOLDER_ID=$($GDRIVE list \ | |
--query "mimeType = 'application/vnd.google-apps.folder' and title contains '${PROJECT_NAME}'" --noheader \ | |
| head -n 1 | awk '{print $1}') | |
# Get release folder id | |
RELEASE_FOLDER_ID=$($GDRIVE list \ | |
--query "mimeType = 'application/vnd.google-apps.folder' and title contains 'release' and '${PROJECT_FOLDER_ID}' in parents" --noheader \ | |
| head -n 1 | awk '{print $1}') | |
# Upload apk to GDrive release folder | |
echo "Uploading $APPLICATION_APK to Google Drive..." | |
$GDRIVE upload -f $APPLICATION_APK -p $RELEASE_FOLDER_ID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment