How to deploy to github with file pattern on travis?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 13:31:13

问题


I have created a simple travis configuration which packages an app and tries to deploy the archive file to github. The problem is, I would like to have the version number part of the file name, so i require to use a pattern for the filename. I simply can't get it to work.

Configuration is currently:

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

But it fails with: "/home/travis/.rvm/gems/ruby-1.9.3-p547/gems/octokit-3.3.1/lib/octokit/client/releases.rb:86:in `initialize': No such file or directory - build/distributions/worktrail-app-hub-sync*.zip (Errno::ENOENT)" - but the file is certainly there: build/distributions/worktrail-app-hub-sync-0.0.1.zip

Example run: 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

Is this supported by travis deployment, or is there any workaround for this use case?


回答1:


Wildcards are supported by now if you enable the file_glob option. This is how I deploy a build .deb file to GitHub releases:

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

Setting up is easy by executing travis setup releases with a dummy filename and modifying .travis.yml afterwards.




回答2:


deploy:
  file_glob: true
  file: "build/distributions/worktrail-app-hub-sync*.zip"

example




回答3:


Sorry, wildcard patterns don't work at the moment, but we'll have a look into making that possible on Travis CI.



来源:https://stackoverflow.com/questions/25929225/how-to-deploy-to-github-with-file-pattern-on-travis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!