Travis-CI跳过部署,尽管已标记“提交" [英] Travis-CI skipping deployment although Commit is tagged

查看:79
本文介绍了Travis-CI跳过部署,尽管已标记“提交"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Travis CI相当陌生,但是我使用他们的文档找到了解决方法.但是,部署到GitHub版本对我不起作用. 我的.travis.yml文件如下所示:

I'm quite new to Travis CI, but I found my way through it using their docs. However deploying to GitHub releases doesn't work for me. My .travis.yml file looks like this:

language: java

branches:
  only:
  - master

notifications:
  email: false

before_deploy:
  - export RELEASE_JAR_FILE=$(ls build/libs/*.jar)
  - echo "Deploying $RELEASE_JAR_FILE to GitHub"

deploy:
  provider: releases
  api_key:
    secure: [key]
  file_glob: true
  file: "${RELEASE_JAR_FILE}"
  skip_cleanup: true
  on:
    repo: [my-repo]
    tags: true
    all_branches: true

这是我的提交方式:

$ git add . && git commit -m "my message"
$ git tag 0.1234
$ git push origin --tags
$ git push origin master

此后,Travis创建构建并使用

After that, Travis creates the build and skips deployment with

Skipping a deployment with the releases provider because this is not a tagged commit

当我在浏览器中打开GitHub存储库时,发布已正确标记,但Travis并未将其检测为已标记.

When I open up my GitHub repository in my browser, the releases are tagged correctly, yet Travis doesn't detect them as tagged.

有人对此有解决方案吗?尽管Travis 一次将没有on: tags: true标志的发布发布到GitHub,但我怀疑branches: only: master部分是造成此行为的原因.之后,如果我省略了标记,说我只能将标记的提交作为发布发布,则会出现错误.

Does anybody have a solution for this? I suspected the branches: only: master part to be responsible for this behaviour, although Travis once pushed a release to GitHub without the on: tags: true flag. Afterwards I got errors if I left out the flag saying that I may only push tagged commits as release.

推荐答案

您需要删除

branches:
    only:
    - master

请参见 https://github.com/travis-ci /travis-ci/issues/2498#issuecomment-48337712

我知道这真是令人讨厌,但是我不确定Travis是否可以按照您想要的方式进行配置.您可能要打开一张票- https://github.com/travis-ci /travis-ci/issues/new

I realize this is a bummer, but I am not sure that Travis can be configured in the way you desire. You may want to open a ticket - https://github.com/travis-ci/travis-ci/issues/new

更新:

branches.only中的标签使用正则表达式:

Use a regex for the tags in branches.only:

branches:
    only:
    - master
    - /v\d+\.\d+[a-z]/

这篇关于Travis-CI跳过部署,尽管已标记“提交"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆