【问题标题】:How to deploy to github with file pattern on travis?如何在 travis 上使用文件模式部署到 github?
【发布时间】:2014-11-13 18:30:55
【问题描述】:

我创建了一个简单的 travis 配置,它打包一个应用程序并尝试将存档文件部署到 github。 问题是,我想要文件名的版本号部分,所以我需要使用文件名的模式。我根本无法让它工作。

目前的配置是:

deploy:
  provider: releases
  file: "build/distributions/worktrail-app-hub-sync*.zip"
  on:
    repo: worktrail/worktrail-app-hub-sync
    tags: true
    all_branches: true

但它失败了:“/home/travis/.rvm/gems/ruby-1.9.3-p547/gems/octokit-3.3.1/lib/octokit/client/releases.rb:86:in `initialize ':没有这样的文件或目录 - build/distributions/worktrail-app-hub-sync*.zip (Errno::ENOENT)" - 但该文件肯定存在:build/distributions/worktrail-app-hub-sync-0.0 .1.zip

示例运行:https://travis-ci.org/worktrail/worktrail-app-hub-sync/builds/35704111 travis.yml:https://github.com/worktrail/worktrail-app-hub-sync/blob/0.0.1/.travis.yml

travis 部署是否支持此功能,或者此用例是否有任何解决方法?

【问题讨论】:

  • 他们可以制作关于它的文档,事情会更容易一些..

标签: github travis-ci


【解决方案1】:

如果您启用file_glob 选项,现在支持通配符。这就是我将构建 .deb 文件部署到 GitHub 版本的方式:

before_deploy:
  - export RELEASE_PKG_FILE=$(ls *.deb)
  - echo "deploying $RELEASE_PKG_FILE to GitHub releases"
deploy:
  provider: releases
  api_key:
    secure: YOUR_ENCRYPTED_API_KEY
  file_glob: true
  file: "${RELEASE_PKG_FILE}"
  on:
    tags: true

通过使用虚拟文件名执行travis setup releases 并在之后修改.travis.yml 来轻松设置。

【讨论】:

  • 现在甚至不再需要“file_glob: true”
  • “file_glob: true”对我来说是必须的,所以@hennr 的信息似乎不正确。
  • @cburgmer 在没有它的情况下为我工作:github.com/hennr/marabou/blob/master/.travis.yml
  • 显然 shell 正在为您的设置解析 glob 模式?
【解决方案2】:
deploy:
  file_glob: true
  file: "build/distributions/worktrail-app-hub-sync*.zip"

example

【讨论】:

    【解决方案3】:

    抱歉,通配符模式目前不起作用,但我们将研究如何在 Travis CI 上实现这一点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-12-28
      • 2020-09-10
      • 2014-11-13
      • 1970-01-01
      • 2023-03-24
      • 2018-01-31
      • 1970-01-01
      相关资源
      最近更新 更多