问题描述
我想在推送一个看起来像语义版本的标签时启动npm部署,例如 v1.2.3
.我看到标记名称在 TRAVIS_TAG
环境变量中,并且我可以指定 on:
条件,该条件可以是任何Bash条件".我不知道在这里写什么以及如何调试它.
I want to kick off an npm deployment when a tag, that looks like a semantic version, is pushed, e.g. v1.2.3
. I see that the tag name is in the TRAVIS_TAG
environment variable and that I can specify an on:
condition, which "can be any Bash condition". I have no idea what to write here and how to debug it.
-提供者:npm上:标签:真all_branches:是状况: ???
理想情况下,我根本不想理会Bash-我希望有条件执行Node.js脚本,然后根据节点退出代码决定是否部署.我该怎么办?
Ideally, I would like to not bother with Bash at all - I would like the condition to execute a Node.js script and then decide whether to deploy or not depending on the node exit code. How can I do that?
推荐答案
bash仍然是最简单的方法,仅当标签名称与正则表达式"release.*"匹配时,此示例才会部署:
Simplest way would still be with bash, this example will deploy only if tag name matches the regex "release.*":
on:
tags: true
all_branches: true
condition: "$TRAVIS_TAG =~ ^release.*$"
查看此链接以获取有关travis环境变量的更多信息: http://docs.travis-ci.com/user/ci-environment/#Environment-变量
Check out this link for more info on travis environment variables:http://docs.travis-ci.com/user/ci-environment/#Environment-variables
这篇关于仅当标签名称与正则表达式匹配时,如何启动Travis CI部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!