Skip to content

Commit 17fd263

Browse files
nikit19iamareebjamal
authored andcommitted
chore: Add scripts to automate playstore release (fossasia#278)
* chore: add scripts to automate playstore release * chore: Add encrypted key
1 parent 605c593 commit 17fd263

File tree

5 files changed

+36
-0
lines changed

5 files changed

+36
-0
lines changed

Diff for: .gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,7 @@ fabric.properties
130130
### AndroidStudio Patch ###
131131

132132
!/gradle/wrapper/gradle-wrapper.jar
133+
134+
fastlane.json
135+
key.jks
136+
secrets.tar

Diff for: .travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ install:
2121
script:
2222
- ./gradlew build
2323
after_success:
24+
- bash scripts/prep-key.sh
2425
- bash scripts/update-apk.sh

Diff for: scripts/prep-key.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
set -e
3+
4+
export DEPLOY_BRANCH=${DEPLOY_BRANCH:-master}
5+
6+
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "fossasia/open-event-android" -o "$TRAVIS_BRANCH" != "$DEPLOY_BRANCH" ]; then
7+
echo "We decrypt key only for pushes to the master branch and not PRs. So, skip."
8+
exit 0
9+
fi
10+
11+
# Decrypt keys
12+
openssl aes-256-cbc -K $encrypted_59a1db41ee4d_key -iv $encrypted_59a1db41ee4d_iv -in ./scripts/secrets.tar.enc -out ./scripts/secrets.tar -d
13+
tar xvf ./scripts/secrets.tar -C scripts/

Diff for: scripts/secrets.tar.enc

20 KB
Binary file not shown.

Diff for: scripts/update-apk.sh

+18
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ if [ "$TRAVIS_BRANCH" == "$DEPLOY_BRANCH" ]; then
4747
done
4848
fi
4949

50+
# Signing Apps
51+
52+
if [ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then
53+
echo "Push to master branch detected, signing the app..."
54+
cp app-release-unsigned.apk app-release-unaligned.apk
55+
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
56+
${ANDROID_HOME}/build-tools/27.0.3/zipalign -v -p 4 app-release-unaligned.apk app-release.apk
57+
fi
58+
5059
# Create a new branch that will contains only latest apk
5160
git checkout --orphan temporary
5261

@@ -61,3 +70,12 @@ git branch -m apk
6170

6271
# Force push to origin since histories are unrelated
6372
git push origin apk --force --quiet > /dev/null
73+
74+
# Publish App to Play Store
75+
if [ "$TRAVIS_BRANCH" != "$PUBLISH_BRANCH" ]; then
76+
echo "We publish apk only for changes in master branch. So, let's skip this shall we ? :)"
77+
exit 0
78+
fi
79+
80+
gem install fastlane
81+
fastlane supply --apk test-app-release.apk --track alpha --json_key ../scripts/fastlane.json --package_name $PACKAGE_NAME

0 commit comments

Comments
 (0)