aboutsummaryrefslogtreecommitdiff
path: root/generate-apk-release.sh
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-07-03 14:25:48 -0700
committerAllan Wang <me@allanwang.ca>2019-07-03 14:25:48 -0700
commitcfc1982400fce040510f8f96b87b377635f97ebf (patch)
tree1085695a3a6333d174d92af17d547095c872c9f1 /generate-apk-release.sh
parented499166fa2842743c80f651b99ee6c963281c2a (diff)
downloadfrost-cfc1982400fce040510f8f96b87b377635f97ebf.tar.gz
frost-cfc1982400fce040510f8f96b87b377635f97ebf.tar.bz2
frost-cfc1982400fce040510f8f96b87b377635f97ebf.zip
Wrap must bash variables with braces
Diffstat (limited to 'generate-apk-release.sh')
-rwxr-xr-xgenerate-apk-release.sh24
1 files changed, 12 insertions, 12 deletions
diff --git a/generate-apk-release.sh b/generate-apk-release.sh
index d776334d..c9b44358 100755
--- a/generate-apk-release.sh
+++ b/generate-apk-release.sh
@@ -13,12 +13,12 @@ VERSION_KEY=Frost
# Make version key different from module name
# create a new directory that will contain our generated apk
-mkdir $HOME/$VERSION_KEY/
+mkdir ${HOME}/${VERSION_KEY}/
# copy generated apk from build folder to the folder just created
-cp -a $MODULE_NAME/build/outputs/apk/releaseTest/. $HOME/$VERSION_KEY/
+cp -a ${MODULE_NAME}/build/outputs/apk/releaseTest/. ${HOME}/${VERSION_KEY}/
printf "Moved apks\n"
-ls -a $HOME/${VERSION_KEY}
-if [ -z "$(find $HOME/${VERSION_KEY} -name '*.apk')" ]; then
+ls -a ${HOME}/${VERSION_KEY}
+if [[ -z "$(find ${HOME}/${VERSION_KEY} -name '*.apk')" ]]; then
echo "No apks found"
exit 1
fi
@@ -29,30 +29,30 @@ cd $HOME
git config --global user.email "$EMAIL"
git config --global user.name "$USER_AUTH CI"
# clone the repository in the buildApk folder
-git clone --quiet --branch=master https://$USER_AUTH:$GITHUB_API_KEY@github.com/$RELEASE_REPO.git master > /dev/null
+git clone --quiet --branch=master https://${USER_AUTH}:${GITHUB_API_KEY}@github.com/${RELEASE_REPO}.git master > /dev/null
# create version file
echo "Create Version File"
cd master
-echo "$VERSION_KEY v$TRAVIS_BUILD_NUMBER" > "$VERSION_KEY.txt"
+echo "${VERSION_KEY} v${TRAVIS_BUILD_NUMBER}" > "${VERSION_KEY}.txt"
echo "Push Version File"
git remote rm origin
-git remote add origin https://$USER_AUTH:$GITHUB_API_KEY@github.com/$RELEASE_REPO.git
+git remote add origin https://${USER_AUTH}:${GITHUB_API_KEY}@github.com/${RELEASE_REPO}.git
git add -f .
-git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed [skip ci]"
+git commit -m "Travis build ${TRAVIS_BUILD_NUMBER} pushed [skip ci]"
git push -fq origin master > /dev/null
echo "Create New Release"
-API_JSON="$(printf '{"tag_name": "v%s","target_commitish": "master","name": "v%s","body": "Automatic Release v%s for branch %s %s","draft": false,"prerelease": false}' $TRAVIS_BUILD_NUMBER $TRAVIS_BUILD_NUMBER $TRAVIS_BUILD_NUMBER "\`$TRAVIS_BRANCH\`" "\nhttps://github.com/$TRAVIS_REPO_SLUG/commit/$TRAVIS_COMMIT")"
-newRelease="$(curl --data "$API_JSON" https://api.github.com/repos/$RELEASE_REPO/releases?access_token=$GITHUB_API_KEY)"
+API_JSON="$(printf '{"tag_name": "v%s","target_commitish": "master","name": "v%s","body": "Automatic Release v%s for branch %s %s","draft": false,"prerelease": false}' ${TRAVIS_BUILD_NUMBER} ${TRAVIS_BUILD_NUMBER} ${TRAVIS_BUILD_NUMBER} "\`${TRAVIS_BRANCH}\`" "\nhttps://github.com/${TRAVIS_REPO_SLUG}/commit/${TRAVIS_COMMIT}")"
+newRelease="$(curl --data "${API_JSON}" https://api.github.com/repos/${RELEASE_REPO}/releases?access_token=${GITHUB_API_KEY})"
rID="$(echo "$newRelease" | jq ".id")"
-cd $HOME/${VERSION_KEY}
+cd ${HOME}/${VERSION_KEY}
echo "Push apk to $rID"
for apk in $(find *.apk -type f); do
apkName="${apk::-4}"
printf "Apk $apkName\n"
- curl "https://uploads.github.com/repos/${RELEASE_REPO}/releases/${rID}/assets?access_token=${GITHUB_API_KEY}&name=${apkName}-v${TRAVIS_BUILD_NUMBER}.apk" --header 'Content-Type: application/zip' --upload-file $apkName.apk -X POST
+ curl "https://uploads.github.com/repos/${RELEASE_REPO}/releases/${rID}/assets?access_token=${GITHUB_API_KEY}&name=${apkName}-v${TRAVIS_BUILD_NUMBER}.apk" --header 'Content-Type: application/zip' --upload-file ${apkName}.apk -X POST
done
echo -e "Done\n" \ No newline at end of file