Skip to content

Commit

Permalink
Automatic sending of IITC-Mobile app to Google Play (#305)
Browse files Browse the repository at this point in the history
Added build process for the main branch and automatic submission of the IITC-Mobile app to Google Play in beta status.
Refusing to use number of commits as `versionCode` due to possibility of reducing the number of `versionCode`, which requires reinstalling android application. Using a date of commit as versionCode.
Enabled `proguard` rules for beta and release builds.
  • Loading branch information
modos189 committed Dec 12, 2020
1 parent 940ff66 commit a34b800
Show file tree
Hide file tree
Showing 25 changed files with 99 additions and 27 deletions.
33 changes: 24 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,70 @@
language: android
jdk: oraclejdk8

branches:
only:
- test-builds
- /^v([0-9]+)\.([0-9]+).*$/
- master
- test-builds
- /^v([0-9]+)\.([0-9]+).*$/

android:
components:
- platform-tools
- tools
- build-tools-28.0.3
- android-28
- extra-android-m2repository

addons:
apt:
sources: deadsnakes
packages: python3.7
ssh_known_hosts: ssh.iitc.app

notifications:
email:
on_success: change
on_failure: always

jobs:
include:
- stage: test-builds
if: branch = test-builds
env: BUILD_TYPE=test
- stage: beta
if: branch = master
env: BUILD_TYPE=beta
- stage: release
if: branch != test-builds
if: NOT branch IN (test-builds, master)
env: BUILD_TYPE=release

before_install: sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
before_install:
- sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
- bundle install --path vendor/bundle

before_script:
- git fetch --unshallow
- wget https://iitc.app/deploy/localbuildsettings.py

script: ./build.py $BUILD_TYPE

deploy:
# deploy to iitc site
- provider: script
skip_cleanup: true
script: curl -s https://iitc.app/deploy/deploy.sh | bash -s -- $BUILD_TYPE
on:
branch: test-builds
all_branches: true

# deploy to google play
- provider: script
skip_cleanup: true
script: curl -s https://iitc.app/deploy/deploy.sh | bash -s -- $BUILD_TYPE
script:
- echo $GOOGLE_PLAY_ACCOUNT > gplay_api.json
- bundle exec fastlane deploy_$BUILD_TYPE
on:
tags: true
branch: master

# deploy to github releases
- provider: releases
skip_cleanup: true
name: $TRAVIS_TAG
Expand All @@ -60,4 +76,3 @@ deploy:
- ./build/release/*.zip
on:
tags: true
branch: master
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "fastlane"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Ingress Intel Total Conversion (IITC)
=====================================

<!-- [START badges] -->
[![Build Status](http://img.shields.io/travis/IITC-CE/ingress-intel-total-conversion/master.svg?label=beta)](https://travis-ci.org/IITC-CE/ingress-intel-total-conversion)
[![Build Status](http://img.shields.io/travis/IITC-CE/ingress-intel-total-conversion/test-builds.svg?label=test-builds)](https://travis-ci.org/IITC-CE/ingress-intel-total-conversion)
[![Docs Status](https://readthedocs.org/projects/iitc-ce/badge/?version=latest)](https://readthedocs.org/projects/iitc-ce/)
[![LICENSE](https://img.shields.io/badge/license-ISC-blue.svg)](LICENSE)
Expand Down
2 changes: 1 addition & 1 deletion build_mobile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
}
iitc_script = 'total-conversion-build.user.js'
buildtypes = {'debug', 'release'}
buildtypes = {'debug', 'beta', 'release'}


def add_default_settings(build_source):
Expand Down
1 change: 1 addition & 0 deletions fastlane/Appfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
json_key_file("gplay_api.json")
32 changes: 32 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#

default_platform(:android)

platform :android do
desc "Deploy of beta version to Google Play"
lane :deploy_beta do
upload_to_play_store(track: "beta",
package_name: "org.exarhteam.iitc_mobile",
apk: "build/beta/IITC_Mobile-beta.apk"
end

desc "Deploy of release to Google Play"
lane :deploy_release do
upload_to_play_store(track: "release",
package_name: "org.exarhteam.iitc_mobile",
apk: "build/release/IITC_Mobile-release.apk"
end
end



8 changes: 8 additions & 0 deletions fastlane/metadata/android/en-US/full_description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
IMPORTANT NOTE: this app runs on data hosted by Ingress. Prior to leaving a bad rating please try https://intel.ingress.com/ and note the load time and please take that in consideration when leaving your review thank you.

Ingress Intel Total Conversion - Community Edition (IITC-CE) is a browser addon for the Ingress augmented reality game. It is faster than the standard Ingress map, and offers many more features.

It is available for desktop browsers, such as Firefox and Chrome, and as a mobile application.

Website: https://iitc.app
GitHub Repository: https://github.com/IITC-CE/ingress-intel-total-conversion/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fastlane/metadata/android/en-US/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/short_description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IITC-CE map for Ingress Prime game
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/title.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IITC-CE Mobile
Empty file.
8 changes: 8 additions & 0 deletions fastlane/metadata/android/ru-RU/full_description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ВАЖНО: это приложение использует данные, размещённые на сервере Ingress. Перед выставлением плохой оценки, пожалуйста, попробуйте открыть https://intel.ingress.com/ и обратите внимание на работу ресурса и время загрузки. Спасибо.

Ingress Intel Total Conversion - Community Edition (IITC-CE) - это браузерное дополнение для игры в дополненной реальности Ingress. Работает быстрее, чем стандартная Ingress карта, и предлагает множество других функций.

IITC-CE доступен для компьютерных браузеров, таких как Firefox и Chrome, а также в виде приложения для Android.

Сайт: https://iitc.app
GitHub репозиторий: https://github.com/IITC-CE/ingress-intel-total-conversion/
1 change: 1 addition & 0 deletions fastlane/metadata/android/ru-RU/short_description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Карта IITC-CE для игры Ingress Prime
1 change: 1 addition & 0 deletions fastlane/metadata/android/ru-RU/title.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IITC-CE Mobile
Empty file.
23 changes: 14 additions & 9 deletions mobile/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ apply plugin: 'com.android.application'

final BUILD_DATE = new Date().format('yyyy.MM.dd-HH:mm')

def getVersionCode = { ->
def git = 'git rev-list HEAD --count'
def getVersionCodeTimeStamps = { ->
def git = 'git log -1 --pretty=format:%ct'

def proc = git.execute()
proc.waitFor()
def desc = "${proc.in.text}".trim()
def unixtime = "${proc.in.text}".trim()

if (desc.isEmpty()) {
println "ERROR setting version code"
if (unixtime.isEmpty()) {
println "Failed to get commit date"
return -1
}
return Integer.parseInt(desc)
return Integer.parseInt(unixtime)
}

android {
Expand All @@ -24,7 +24,7 @@ android {
applicationId "org.exarhteam.iitc_mobile"
minSdkVersion 17
targetSdkVersion 28
versionCode = getVersionCode()
versionCode = getVersionCodeTimeStamps()
versionName "0.30.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -55,11 +55,16 @@ android {
applicationIdSuffix ".debug"
versionNameSuffix "-test-$BUILD_DATE"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.debug
}
beta {
versionNameSuffix "-beta-$BUILD_DATE"
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.NullPointerException;

// provide communication between IITC script and android app
public class IITC_JSInterface {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.exarhteam.iitc_mobile.prefs;

import android.Manifest;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
Expand All @@ -21,8 +20,6 @@
import android.widget.TextView;
import android.widget.Toast;

import androidx.core.app.ActivityCompat;

import org.exarhteam.iitc_mobile.IITC_FileManager;
import org.exarhteam.iitc_mobile.IITC_NotificationHelper;
import org.exarhteam.iitc_mobile.Log;
Expand Down
5 changes: 2 additions & 3 deletions mobile/app/src/main/res/layout/pref_main.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:id="@+id/container"
Expand Down
2 changes: 1 addition & 1 deletion mobile/app/src/main/res/xml/provider_paths.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<paths>
<external-path name="external_files" path="."/>
</paths>

0 comments on commit a34b800

Please sign in to comment.