Skip to content

Commit

Permalink
enhancement: improved APK Names
Browse files Browse the repository at this point in the history
  • Loading branch information
adityastic committed Jul 2, 2019
1 parent 7e8a10e commit 8c2195b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 25 deletions.
4 changes: 1 addition & 3 deletions scripts/prep-key.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/bin/sh
set -e

export DEPLOY_BRANCH=${DEPLOY_BRANCH:-master}

if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "fossasia/badge-magic-android" -o "$TRAVIS_BRANCH" != "$DEPLOY_BRANCH" ]; then
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "fossasia/badge-magic-android" ]; then
echo "We decrypt key only for pushes to the master branch and not PRs. So, skip."
exit 0
fi
Expand Down
38 changes: 16 additions & 22 deletions scripts/upload-apk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,24 @@ else
fi

\cp -r ../app/build/outputs/apk/*/**.apk .
\cp -r ../app/build/outputs/apk/debug/output.json debug-output.json
\cp -r ../app/build/outputs/apk/release/output.json release-output.json
\cp -r ../README.md .

# Signing Apps

if [[ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]]; then
echo "Push to master branch detected, signing the app..."
cp app-release-unsigned.apk app-release-unaligned.apk
jarsigner -verbose -tsa http://timestamp.comodoca.com/rfc3161 -sigalg SHA1withRSA -digestalg SHA1 -keystore ../scripts/key.jks -storepass $STORE_PASS -keypass $KEY_PASS app-release-unaligned.apk $ALIAS
${ANDROID_HOME}/build-tools/28.0.3/zipalign -v -p 4 app-release-unaligned.apk app-release.apk
fi

if [[ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]]; then
for file in app*; do
mv ${file} badge-magic-master-${file%%}
done
fi

if [[ "$TRAVIS_BRANCH" == "$DEPLOY_BRANCH" ]]; then
for file in app*; do
mv ${file} badge-magic-dev-${file%%}
done
fi
cp app-release-unsigned.apk app-release-unaligned.apk
jarsigner -verbose -tsa http://timestamp.comodoca.com/rfc3161 -sigalg SHA1withRSA -digestalg SHA1 -keystore ../scripts/key.jks -storepass $STORE_PASS -keypass $KEY_PASS app-release-unaligned.apk $ALIAS
${ANDROID_HOME}/build-tools/28.0.3/zipalign -v -p 4 app-release-unaligned.apk app-release.apk

#removing unused apps
for file in app*; do
if [[ ${file} =~ "unsigned" || ${file} =~ "unaligned" ]]; then
rm ${file}
else
if [[ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]]; then
mv ${file} badge-magic-master-${file:4}
elif [[ "$TRAVIS_BRANCH" == "$DEPLOY_BRANCH" ]]; then
mv ${file} badge-magic-dev-${file:4}
fi
fi
done

# Create a new branch that will contains only latest apk
git checkout --orphan temporary
Expand Down

0 comments on commit 8c2195b

Please sign in to comment.