Travis.ci-构建和部署基于PR和标签的

时间:2019-06-16 16:13:31

标签: travis-ci

我正在尝试在travis.ci中创建两个不同的动作。第一步是在每个分支的每次推送上执行脚本。当前正在按需工作。第二种是仅在git push origin --tags时触发一个不同的脚本。简而言之:

  1. 始终执行script1(当前正在工作)
  2. 按下标签时执行script2

这是我正在尝试的:

language: python
python:
  - 3.7
matrix:
  include:
    - python: 3.7
      sudo: true
install:
  - pip install -r requirements.txt
script: # Always want this to happen
  - invoke package
branches:
  only:
    - master
    - /^x\/.*/
deploy: # Want this to occur on git push origin --tags
  provider: script
  script: invoke release
  on:
    tags: true

部署部分没有被触发,并且找不到invoke release脚本被调用的证据。

更新: 这可能是由于我推送标签的方式..?我现在在travis中看到此日志:

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

1 个答案:

答案 0 :(得分:0)

this github issue解决了它。将部署部分更改为:

deploy:
  provider: script
  script: invoke release
  on:
    tags: true
    all_branches: true

,但必须删除分支部分。尽管如此,部署脚本仍被调用。

相关问题