Felix Gutierrez
Felix Gutierrez

Reputation: 309

Add apk to zip Gitlab-CI? Artifacts .gitlab-ci.yml Configuration

Following the documentation of http://doc.gitlab.com/ee/ci/yaml/README.html to set the file .yml I found the problem by creating artifacts, when builds the APK file to be downloaded this ZIP includes all folders: app / build / outputs / apk , I am interested only add the resulting APK to ZIP file to be downloaded.

.gitlab-ci.yml

dev:
 script:
       - ./gradlew assembleDebug

 artifacts:
    name: "$CI_BUILD_NAME"
    paths:
         - app/build/outputs/apk/app-debug.apk

Upvotes: 2

Views: 2626

Answers (1)

Felix Gutierrez
Felix Gutierrez

Reputation: 309

build.gradle file:

applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def apk = output.outputFile;
            def newName = "app-release-" + "myapp" + ".apk";
            output.outputFile = new File('./', newName);
        }
    }

.yml file:

dev:


script:
       - ./gradlew assembleDebug

 artifacts:
    name: "${CI_BUILD_NAME}_${CI_BUILD_REF_NAME}"
    paths:
         - app/*.apk

this solves the problem.

Upvotes: 4

Related Questions