github - 如何在travis上使用文件模式部署到github?

标签 github travis-ci

我创建了一个简单的 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 部署是否支持此功能,或者此用例是否有任何解决方法?

最佳答案

如果您启用 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 setupreleases并随后修改.travis.yml,设置很容易。

关于github - 如何在travis上使用文件模式部署到github?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25929225/

相关文章:

phpunit - travis-ci 中的可视化代码覆盖率

.net-core - 在 Travis CI 上构建 .NET Core 2.0

GitHub Branch Source Plugin --> 仅扫描 Pull Request

github - 有没有办法在运行 gh 操作时获取工作流程 ID

git - Jira Smart 提交未运行的命令

go - 特拉维斯错误: The command "go get -u -v github.com/spf13/hugo" failed and exited with 1 during

ios - travis 上的 Cocoapod CI 无法安装依赖项

docker - (GitHub Actions,上传工件)尽管授予文件完全权限,但尝试上传文件时访问被拒绝

php - Composer 下载整个 .git 存储库目录