You can either set up the S3 variables for all projects or per individual project if you prefer.
In this example, I will do it for all projects. Just open the build.gradle
file and add the following code.
allprojects {
project.ext.AWS_S3_BUCKET = "YOUR BUCKET NAME"
project.ext.AWS_S3_KEY_ID = "YOUR BUCKED SECRET ID"
project.ext.AWS_S3_KEY_SECRET = "YOUR BUCKED SECRET KEY"
project.ext.AWS_S3_APK_TARGET_FOLDER = "YOUR S3 TARGET FOLDER"
}
If possible, I highly recommend that you save the Access Key and Secret Key as environment variables so they won't end up in your code repository.
Download the publishApkToS3.gradle
file and put it in your app folder.
Then, in the build.gradle
of each application you want to publish add the following:
apply from: 'publishApkToS3.gradle'
Finally, you just have to execute the task using the command publish{flavor-name}ToS3
.
PS: This script uses CURL, so make sure you have it installed in your machine.
@biklas7 this is not working anymore. I'm facing the following issue
Any idea how to fix this issue?