This is the DeployGate plugin for the Gradle. You can build and deploy your apps to DeployGate by running a single task.
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.
- Open your
build.gradle
on your project root and add a dependency.
dependency {
classpath 'com.deploygate:gradle:1.1.0'
}
- Open your module build script file (e.g.
app/build.gradle
) and add the following line just afterapply plugin: 'com.android.application'
.
apply plugin: 'deploygate'
-
If you are using Android Studio, click Sync Now link appearing on the right top corner of your editor window.
-
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.
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 locallylogoutDeployGate
- Delete current credentials
If you define flavors in apks
section, there will also be uploadDeployGate
task which can upload all the flavors at once.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.deploygate:gradle:1.1.0' // add this line
}
}
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")
}
}
}
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.
- Add noAssemble option for just uploading artifacts (by @operando)
- Fix: Browser doesn't open on the first upload
- Open the app page for the first upload or environment variable set
- Restore
uploadDeployGate
feature
- Prevent invoking browser on headless environment
- Allow passing values from environment variable
- 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 yourbuild.gradle
.
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.