Android Apk 部署到 Github 使用 Travis 发布

Android Apk Deployment to Github Releases With Travis

我配置了我的 .travis.yml 文件来构建我的应用程序并将其部署到 github 版本。虽然应用程序构建成功并且看起来一切顺利(travis 日志中没有错误消息)

结果我只收到一条消息,表明部署失败。我在某处读到,免费使用 travis 仅适用于 public 个存储库,而我的是一个私有存储库。这可能是原因还是我错过了什么? 为了完整性:

#app level gradle

    task printVersionName {
        doLast {
            println android.defaultConfig.versionName
        }
    }

这是 .travis.yml

的相关部分
before_install:
  - openssl aes-256-cbc -K .. (I would assume this part is correct because when it wasn't I got an error from here)
    script:
      - "./gradlew assembleRelease"
    before_deploy:
      - export APP_VERSION=$(./gradlew :app:printVersionName)
    deploy:
      - provider: releases
        api_key: 000000000000 #Of course here is different
        file: app/build/outputs/apk/release/*
        file_glob: true
        skip_cleanup: true
        overwrite: true
        name: "$APP_VERSION"
        tag_name: "$APP_VERSION"
        on:
          branch: travis

这是 travis 日志的最后一部分。

> Task :app:lintVitalRelease
> Task :app:assembleRelease
BUILD SUCCESSFUL in 4m 16s
38 actionable tasks: 38 executed
The command "./gradlew assembleRelease" exited with 0.
before_cache.1
0.01s$ rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
before_cache.2
0.01s$ rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache.2
store build cache
before_deploy
10.76s$ export APP_VERSION=$(./gradlew :app:printVersionName)
dpl_0
1.80s$ rvm $(travis_internal_ruby) --fuzzy do ruby -S gem install dpl
Successfully installed dpl-1.10.15
Parsing documentation for dpl-1.10.15
Installing ri documentation for dpl-1.10.15
Done installing documentation for dpl after 0 seconds
1 gem installed
invalid option "--name=To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/4.10.1/userguide/gradle_daemon.html.\nDaemon will be stopped at the end of the build stopping after processing\n\n> Configure project :app\nWARNING: API 'variant.getAssemble()' is obsolete and has been replaced with 'variant.getAssembleProvider()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variant.getAssemble(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nWARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nWARNING: API 'variantOutput.getProcessManifest()' is obsolete and has been replaced with 'variantOutput.getProcessManifestProvider()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variantOutput.getProcessManifest(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nWARNING: API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variant.getMergeResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nWARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nWARNING: API 'variant.getPackageApplication()' is obsolete and has been replaced with 'variant.getPackageApplicationProvider()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variant.getPackageApplication(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nWARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variant.getExternalNativeBuildTasks(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nWARNING: API 'variant.getPreBuild()' is obsolete and has been replaced with 'variant.getPreBuildProvider()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variant.getPreBuild(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)\nregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)\nregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)\nregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)\nregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)\nregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)\n\n> Task :app:printVersionName\n1.0013\n\nBUILD SUCCESSFUL in 10s\n1 actionable task: 1 executed"
failed to deploy

我的错误可能是什么原因造成的?我查看了 travis 的 6039 行输出,但我 %99.99 确定没有明确的消息表明部署失败的原因。

有趣的是,如果我将 travis.yml 的部署更改为更简单的部署,构建成功但部署仍未完成,因为构建未标记

简体.travis.yml

deploy:
  - provider: releases
    api_key: 000000000
    file: app/build/outputs/apk/release/*
    file_glob: true
    skip_cleanup: true
    overwrite: true
    name: "$APP_VERSION"
    tag_name: "$APP_VERSION"
    on:
      branch: travis

此信息可能有助于在较小范围内检查问题。

好像

 name: "$APP_VERSION"
            tag_name: "$APP_VERSION

travis build 不再被接受。我用以下标记构建。

 before_deploy:

      - git tag "Your custom tag"