GithubHelp home page GithubHelp logo

kohei-takata / gradle-deploygate-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from deploygate/gradle-deploygate-plugin

0.0 1.0 0.0 423 KB

DeployGate plugin for the Gradle build system.

Shell 0.22% Groovy 99.78%

gradle-deploygate-plugin's Introduction

Gradle DeployGate Plugin

Build Status

This is the DeployGate plugin for the Gradle. You can build and deploy your apps to DeployGate by running a single task.

Getting started

dg deploy way (for OS X)

If you have installed dg command on your Mac, just move to your project root directory and type dg deploy.

cd Your/Project/Root
dg deploy

dg will setup the Gradle DeployGate Plugin on your project (if not yet installed) and start uploading.

Gradle way

  1. Open your build.gradle on your project root and add a dependency.
dependency {
  classpath 'com.deploygate:gradle:1.1.4'
}
  1. Open your module build script file (e.g. app/build.gradle) and add the following line just after apply plugin: 'com.android.application'.
apply plugin: 'deploygate'
  1. If you are using Android Studio, click Sync Now link appearing on the right top corner of your editor window.

  2. You are all set! Open Gradle tab on the right side of your Android Studio, and select Tasks - deploygate - uploadDeployGateDebug under your app module, or you can run as a Gradle command like:

./gradlew :app:uploadDeployGateDebug

By running uploadDeployGate<FlavorName> task, it will build your application, set up your DeployGate credentials (for the first time) and upload your application. You can deploy an update of your application by running the same task.

Usage

Tasks

Run ./gradlew tasks on your project root to see all available tasks.

  • uploadDeployGate[FlavorName] - Build and upload app of [FlavorName]
  • loginDeployGate - Log in to DeployGate and save credentials locally
  • logoutDeployGate - Delete current credentials

If you define flavors in apks section, there will also be uploadDeployGate task which can upload all the flavors at once.

Example of build.gradle

Project Build File

buildscript {
  repositories {
    jcenter()
  }

  dependencies {
    classpath 'com.deploygate:gradle:1.1.0'   // add this line
  }
}

Module Build File

apply plugin: 'deploygate'                    // add this *after* 'android' plugin 

// Optional configurations
deploygate {

  // If you are using automated build, you can specify your account credentials like this
  userName = "[username of app owner]"
  token = "[your API token]"

  // You can also specify additional options for each flavor.
  apks {
    
    // this correspond to `debug` flavor and used for `uploadDeployGateDebug` task 
    debug {
      // ProTip: get git hash for current commit for easier troubleshooting
      def hash = 'git rev-parse --short HEAD'.execute([], project.rootDir).in.text.trim()
      // set as build message
      message = "debug build ${hash}"

      // If this property is `true` , Skip dependency of `assemble` task from `uploadDeployGate` task
      // The default value is `false`
      noAssemble = true

      // if you are using a distribution page, you can update it simultaneously
      distributionKey = "1234567890abcdef1234567890abcdef"
      releaseNote = "release note sample"
    }
    
    // this creates `uploadDeployGateCustom` task to upload arbitrary APK file 
    custom {
      // set target file
      sourceFile = file("${project.rootDir}/app/build/some-custom-build.apk")
    }
  }
}

Environment Variables

If you are using Continuous Integration, you can set these environment variables to provide default values for DeployGate Plugin instead of writing in build.gradle.

  • DEPLOYGATE_USER_NAME
  • DEPLOYGATE_API_TOKEN
  • DEPLOYGATE_MESSAGE
  • DEPLOYGATE_DISTRIBUTION_KEY
  • DEPLOYGATE_RELEASE_NOTE
  • DEPLOYGATE_SOURCE_FILE
  • DEPLOYGATE_OPEN_BROWSER (Env only; open the app page after the uploading finished)

By using environment variables, you can avoid storing your credentials in your source code repository and compose deployment messages dynamically.

For example, you can set application owner user to the organization you are belonging to by running task like:

DEPLOYGATE_USER_NAME=YourOrganizationName ./gradlew :app:uploadDeployGateDebug

Note that these values are used as default values so build.gradle may override them.

Changes

ver 1.1.4

  • Fix producing corrupted task names for flavors on Android Plugin for Gradle 3.0.0 (like uploadDeployGateDev-debug for uploadDeployGateDevDebug)

ver 1.1.3

  • Restore auto configuring APK file path functionality (supports Android Gradle Plugin 3.0.0-alpha4)

ver 1.1.2

  • Fix failing first time upload with Free plans

ver 1.1.1

  • Workaround for the issue on Android Gradle Plugin 3.0 Preview
    • You need to specify the sourceFile option manually in your build.gradle to upload builds. This temporal limitation will be resolved in future release of Android Gradle Plugin.

ver 1.1.0

  • Add noAssemble option for just uploading artifacts (by @operando)

ver 1.0.4

  • Fix: Browser doesn't open on the first upload

ver 1.0.3

  • Open the app page for the first upload or environment variable set

ver 1.0.2

  • Restore uploadDeployGate feature

ver 1.0.1

  • Prevent invoking browser on headless environment
  • Allow passing values from environment variable

ver 1.0.0

  • Support browser log in and share credentials with dg command.
  • DeployGate plugin now handles all Android project automatically, so you don't have to write deploygate settings to your build.gradle.

License

Copyright 2015 DeployGate Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.