Newer
Older
DummyAnd / fastlane / Fastfile
# Customise this file, documentation can be found here:
# https://github.com/fastlane/fastlane/tree/master/fastlane/docs
# All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md
# can also be listed using the `fastlane actions` command

# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`

# If you want to automatically update fastlane if a new version is available:
# update_fastlane

# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "1.101.0"

default_platform :android

platform :android do
  before_all do
    # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
  end

  desc "Runs all the tests"
  lane :test do
    gradle(task: "test")
  end

  desc "Build the apk"
  lane :build do
    gradle(task: "clean assemble")
  end

  desc "Bump version code/build number"
  private_lane :bump do
    increment_version_code(
      var_name: "versionCode|versionBuild",
      verbose: true,
    )
  end

  desc "Tag as a new version"
  private_lane :tag do
    git_commit(
      path: "app/build.gradle",
      message: "Increment version code to #{lane_context[SharedValues::VERSION_CODE]} new tag",
    )
    add_git_tag(
      tag: "#{lane_context[SharedValues::VERSION_CODE]}-{ENV['VERSION']}",
      message: "Create new tag for version #{lane_context[SharedValues::VERSION_CODE]} (#{ENV['VERSION']})",
    )
    push_to_git_remote
    push_git_tags
  end

  desc "Build and deploy the apk for Alpha testing in Google Play store"
  lane :deploy_alpha do
    bump
    gradle(
      task: "clean assemble",
      build_type: 'Release',
    )
    supply(
      apk: 'app/build/outputs/apk/app-release.apk',
      track: 'alpha',
    )
    tag
  end

  desc "Submit a new Beta Build to Crashlytics Beta"
  lane :beta do
    gradle(task: "assembleRelease")
    crashlytics

    # sh "your_script.sh"
    # You can also use other beta testing services here
  end

  desc "Deploy a new version to the Google Play"
  lane :deploy do
    #gradle(task: "assembleRelease")
    #supply
  end

  # You can define as many lanes as you want

  after_all do |lane|
    # This block is called, only if the executed lane was successful

    # slack(
    #   message: "Successfully deployed new App Update."
    # )
  end

  error do |lane, exception|
    # slack(
    #   message: exception.message,
    #   success: false
    # )
  end
end


# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
# All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md

# fastlane reports which actions are used
# No personal data is sent or shared. Learn more at https://github.com/fastlane/enhancer