我正在尝试在 travis.ci 中创建两个不同的操作。第一个操作是在每个分支上的每次推送时执行脚本。这目前正在按预期工作。第二种是仅在git push origin --tags
时触发不同的脚本。总之:
- 始终执行脚本 1(当前工作(
- 推送标签时执行 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
脚本的证据。
更新:这可能是由于我推送标签的方式..?我现在在特拉维斯中看到这个日志:
Skipping a deployment with the script provider because this is not a tagged commit
从这个 github 问题解决了它。将部署部分更改为以下内容:
deploy:
provider: script
script: invoke release
on:
tags: true
all_branches: true
但不得不删除分支部分。尽管如此,还是调用了部署脚本。