Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ cache:
- "$HOME/.gradle/wrapper/"
install:
- echo yes | ${ANDROID_HOME}/tools/bin/sdkmanager "platforms;android-28"
before_script:
- bash scripts/prep-key.sh
script:
- ./gradlew spotlessCheck
- ./gradlew build
after_success:
- bash scripts/prep-key.sh
- bash scripts/update-apk.sh
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Open Event Android App
[![Build Status](https://travis-ci.org/fossasia/open-event-android.svg?branch=development)](https://travis-ci.org/fossasia/open-event-android?branch=development)
[![Build Status](https://travis-ci.org/fossasia/open-event-android.svg?branch=master)](https://travis-ci.org/fossasia/open-event-android?branch=master)
# Open Event Attendee App
[![Build Status](https://travis-ci.org/fossasia/open-event-attendee-android.svg?branch=development)](https://travis-ci.org/fossasia/open-event-attendee-android?branch=development)
[![Build Status](https://travis-ci.org/fossasia/open-event-attendee-android.svg?branch=master)](https://travis-ci.org/fossasia/open-event-attendee-android?branch=master)
[![Join the chat at https://gitter.im/fossasia/open-event-android](https://badges.gitter.im/fossasia/open-event-android.svg)](https://gitter.im/fossasia/open-event-android?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Mailing List](https://img.shields.io/badge/Mailing%20List-FOSSASIA-blue.svg)](https://groups.google.com/forum/#!forum/open-event)
[![Twitter Follow](https://img.shields.io/twitter/follow/eventyay.svg?style=social&label=Follow&maxAge=2592000?style=flat-square)](https://twitter.com/eventyay)
Expand All @@ -22,7 +22,7 @@ Planned features & enhancements are:

Please join our mailing list to discuss questions regarding the project: https://groups.google.com/forum/#!forum/open-event

Our chat channel is on gitter [here](https://gitter.im/fossasia/open-event-android)
Our chat channel is on gitter [here](https://gitter.im/fossasia/open-event-attendee-android)

## Screenshots
<table>
Expand Down Expand Up @@ -92,7 +92,7 @@ We have the following branches
- _versionCode_ : **Integer** : To be monotonically incremented with each merge. Failure to do so will lead to publishing error, and thus is a crucial step before any merge
- _versionName_ : **String** : User visible version of the app. To be changed following [semantic versioning](http://semver.org/)
* **apk** This branch contains two apk's, that are automatically generated on the merged pull request a) debug apk and b) release apk.
- Please download and test the app that is using the code from the development and master branches [here](https://github.com/fossasia/open-event-android/tree/apk).
- Please download and test the app that is using the code from the development and master branches [here](https://github.com/fossasia/open-event-attendee-android/tree/apk).
### Code practices

Please help us follow the best practices to make it easy for the reviewer as well as the contributor. We want to focus on the code quality more than on managing pull request ethics.
Expand All @@ -112,7 +112,7 @@ Please help us follow the best practices to make it easy for the reviewer as wel
If you are a tester and want to test the app, you have two ways to do that:
1. **Installing APK on your device:** You can get debug APK as well as Release APK in apk branch of the repository. After each PR merge, both the APKs are automatically updated. So, just download the APK you want and install it on your device. The APKs will always be the latest one.

## Open Event Android Suggestions
## Open Event Attendee Android Suggestions

- Suggestion form link: [Form](https://docs.google.com/forms/d/e/1FAIpQLSd7Y1T1xoXeYaAG_b6Tu1YYK-jZssoC5ltmQbkUX0kmDZaKYw/viewform)
- Suggestion responses link: [Sheet](https://docs.google.com/spreadsheets/d/1SzR75MBEVrTY1sDM3KAMm9wltiulDAp0QT5hv9eJkKM/edit#gid=1676755229)
Expand Down
21 changes: 21 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'androidx.navigation.safeargs.kotlin'
apply plugin: "com.github.b3er.local.properties"

def STRIPE_API_TOKEN = System.getenv('STRIPE_API_TOKEN') ?: "YOUR_API_KEY"
def MAPBOX_KEY = System.getenv('MAPBOX_KEY') ?: "pk.eyJ1IjoiYW5nbWFzMSIsImEiOiJjanNqZDd0N2YxN2Q5NDNuNTBiaGt6eHZqIn0.BCrxjW6rP_OuOuGtbhVEQg"
def LOCAL_KEY_PRESENT = project.hasProperty('SIGNING_KEY_FILE') && rootProject.file(SIGNING_KEY_FILE).exists()

android {
dataBinding {
Expand All @@ -31,6 +33,23 @@ android {
}
}
}
signingConfigs {
if (TRAVIS_BUILD) {
release {
storeFile KEYSTORE_FILE
storePassword System.getenv("STORE_PASS")
keyAlias System.getenv("ALIAS")
keyPassword System.getenv("KEY_PASS")
}
} else if (LOCAL_KEY_PRESENT) {
release {
storeFile rootProject.file(SIGNING_KEY_FILE)
storePassword STORE_PASS
keyAlias ALIAS
keyPassword KEY_PASS
}
}
}
buildTypes {
release {
shrinkResources true
Expand All @@ -40,6 +59,8 @@ android {
buildConfigField "String", "MAPBOX_KEY", '"'+MAPBOX_KEY+'"'
buildConfigField "String", "STRIPE_API_KEY", '"'+STRIPE_API_TOKEN+'"'
resValue "string", "FRONTEND_HOST", "eventyay.com"
if (LOCAL_KEY_PRESENT || TRAVIS_BUILD)
signingConfig signingConfigs.release
}
debug {
buildConfigField "String", "DEFAULT_BASE_URL", '"https://open-event-api-dev.herokuapp.com/v1/"'
Expand Down
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ buildscript {
google()
mavenCentral()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0'
classpath "gradle.plugin.com.github.b3er.local.properties:local-properties-plugin:1.1"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -25,6 +29,10 @@ allprojects {
mavenCentral()
jcenter()
}
ext {
KEYSTORE_FILE = rootProject.file('scripts/key.jks')
TRAVIS_BUILD = System.getenv("TRAVIS") == "true" && KEYSTORE_FILE.exists()
}
}

task clean(type: Delete) {
Expand Down
7 changes: 4 additions & 3 deletions scripts/prep-key.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/bin/sh
set -e

export DEPLOY_BRANCH=${DEPLOY_BRANCH:-master}
export DEPLOY_BRANCH=${DEPLOY_BRANCH:-development}
export PUBLISH_BRANCH=${PUBLISH_BRANCH:-master}

if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "fossasia/open-event-android" -o "$TRAVIS_BRANCH" != "$DEPLOY_BRANCH" ]; then
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "fossasia/open-event-attendee-android" ] || ! [ "$TRAVIS_BRANCH" == "$DEPLOY_BRANCH" -o "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then
echo "We decrypt key only for pushes to the master branch and not PRs. So, skip."
exit 0
fi

# Decrypt keys
openssl aes-256-cbc -K $encrypted_59a1db41ee4d_key -iv $encrypted_59a1db41ee4d_iv -in ./scripts/secrets.tar.enc -out ./scripts/secrets.tar -d
tar xvf ./scripts/secrets.tar -C scripts/
tar xvf ./scripts/secrets.tar -C scripts/
37 changes: 13 additions & 24 deletions scripts/update-apk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,44 @@ git config --global user.email "noreply+travis@fossasia.org"
export DEPLOY_BRANCH=${DEPLOY_BRANCH:-development}
export PUBLISH_BRANCH=${PUBLISH_BRANCH:-master}

if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "fossasia/open-event-android" ] || ! [ "$TRAVIS_BRANCH" == "$DEPLOY_BRANCH" -o "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_REPO_SLUG" != "fossasia/open-event-attendee-android" ] || ! [ "$TRAVIS_BRANCH" == "$DEPLOY_BRANCH" -o "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then
echo "We upload apk only for changes in development or master, and not PRs. So, let's skip this shall we ? :)"
exit 0
fi

./gradlew bundlePlayStoreRelease

git clone --quiet --branch=apk https://fossasia:$GITHUB_API_KEY@github.com/fossasia/open-event-android apk > /dev/null
git clone --quiet --branch=apk https://fossasia:$GITHUB_API_KEY@github.com/fossasia/open-event-attendee-android apk > /dev/null
cd apk

if [ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then
/bin/rm -f open-event-master-app-playStore-release.apk open-event-master-app-fdroid-release.apk open-event-master-app-playStore-debug.apk open-event-master-app-fdroid-debug.apk
/bin/rm -f open-event-attendee-master-*
else
/bin/rm -f open-event-dev-app-fdroid-debug.apk open-event-dev-app-playStore-debug.apk open-event-dev-app-playStore-release.apk open-event-dev-app-fdroid-release.apk
/bin/rm -f open-event-attendee-dev-*
fi

\cp -r ../app/build/outputs/apk/playStore/*/**.apk .
\cp -r ../app/build/outputs/apk/fdroid/*/**.apk .
\cp -r ../app/build/outputs/apk/playStore/debug/output.json playStore-debug-output.json
\cp -r ../app/build/outputs/apk/playStore/release/output.json playStore-release-output.json
\cp -r ../app/build/outputs/apk/fdroid/debug/output.json fdroid-debug-output.json
\cp -r ../app/build/outputs/apk/fdroid/release/output.json fdroid-release-output.json
find ../app/build/outputs -type f -name '*.apk' -exec cp -v {} . \;
find ../app/build/outputs -type f -name '*.aab' -exec cp -v {} . \;


if [ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then
for file in app*; do
if [[ $file = "open-event"* ]]; then
if [[ $file = "eventyay-attendee"* ]]; then
continue
fi
mv $file open-event-master-${file%%}
mv $file eventyay-attendee-master-${file:4}
done
fi

if [ "$TRAVIS_BRANCH" == "$DEPLOY_BRANCH" ]; then
for file in app*; do
if [[ $file = "open-event"* ]]; then
if [[ $file = "eventyay-attendee"* ]]; then
continue
fi
mv $file open-event-dev-${file%%}
mv $file eventyay-attendee-dev-${file:4}
done
fi

# Signing Apps

if [ "$TRAVIS_BRANCH" == "$PUBLISH_BRANCH" ]; then
echo "Push to master branch detected, signing the app..."
cp open-event-master-app-playStore-release-unsigned.apk open-event-master-app-playStore-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 open-event-master-app-playStore-release-unaligned.apk $ALIAS
${ANDROID_HOME}/build-tools/27.0.3/zipalign -v -p 4 open-event-master-app-playStore-release-unaligned.apk open-event-master-app-playStore-release.apk
fi

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

Expand All @@ -78,4 +67,4 @@ if [ "$TRAVIS_BRANCH" != "$PUBLISH_BRANCH" ]; then
fi

gem install fastlane
fastlane supply --apk open-event-master-app-playStore-release.apk --track alpha --json_key ../scripts/fastlane.json --package_name $PACKAGE_NAME
fastlane supply --aab eventyay-attendee-master.aab --track alpha --json_key ../scripts/fastlane.json --package_name $PACKAGE_NAME