【问题标题】:Add apk to zip Gitlab-CI? Artifacts .gitlab-ci.yml Configuration添加 apk 以压缩 Gitlab-CI?工件 .gitlab-ci.yml 配置
【发布时间】:2016-07-16 04:31:54
【问题描述】:
按照http://doc.gitlab.com/ee/ci/yaml/README.html的文档设置文件.yml我在构建APK文件时通过创建artifacts发现了问题要下载这个 ZIP 包括所有文件夹:app / build / outputs / apk ,我感兴趣的只是将生成的 APK 添加到 要下载的 ZIP 文件。
.gitlab-ci.yml
dev:
script:
- ./gradlew assembleDebug
artifacts:
name: "$CI_BUILD_NAME"
paths:
- app/build/outputs/apk/app-debug.apk
【问题讨论】:
标签:
android
gitlab-ci
gitlab-ci-runner
【解决方案1】:
build.gradle 文件:
applicationVariants.all { variant ->
variant.outputs.each { output ->
def apk = output.outputFile;
def newName = "app-release-" + "myapp" + ".apk";
output.outputFile = new File('./', newName);
}
}
.yml 文件:
dev:
script:
- ./gradlew assembleDebug
artifacts:
name: "${CI_BUILD_NAME}_${CI_BUILD_REF_NAME}"
paths:
- app/*.apk
这解决了问题。