summaryrefslogtreecommitdiff
path: root/fastlane/Fastfile
blob: 523a1334c8f953214e0274c3ea6c1707151acbe0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# 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)

require 'git'

def currentBranch()
  branch = git_branch()
  if !branch.to_s.empty?
    return branch
  end
  git = Git.open(File.join(File.dirname(__FILE__), '../')) # git_branch() does not seem work on Windows, it will print error with path not found.
  return git.current_branch
end


platform :android do
  desc "Description of what the lane does"
  lane :circleci do
    # Here we can add other things that circleci should do
    playstore
  end
  lane :playstore do
    sh("cd ..;bash scripts/build_android.sh")
    
    gradle(
      task: 'assemble',
      build_type: 'Release'
    )
    isOnMasterBranch = currentBranch() == "master"
    if isOnMasterBranch
      upload_to_play_store( track: 'beta', 
      						json_key: 'key.json', 
      						apk: 'navit/android/build/outputs/apk/release/android-release.apk',
      						package_name: 'org.navitproject.navit'
      					  )
    else
      puts "Not on master, no upload to google play"
    end
  end
end