Setup your S3 variables. Highly recommend that the access key and id are referred to as environment variables then they don't end up in your source repo. The snippet below sets up the variables for all projects in your build but you can do it on an individual project basis as well if you prefer.
allprojects {
project.ext.AWS_S3_BUCKET = "my.bucket"
project.ext.AWS_S3_KEY_SECRET = "${aws_accesskey}"
project.ext.AWS_S3_KEY_ID = "${aws_accessid}"
project.ext.AWS_S3_APK_TARGET_FOLDER = "apks"
}
In the gradle script for each application you want to upload simply include the s3-upload
script
apply from: 's3-upload.gradle'
You should then find you get additional task(s) for your application in the form
publish${flavor}ApkToS3
This script makes use of CURL so you need to make sure it is installed on the machine where you run the task.