如果提交消息包含字符串,请运行部署?

时间:2019-03-23 11:12:57

标签: git travis-ci

我正在尝试设置CI,以便如果提交消息包含特定字符串(在我的情况下为

),它将执行部署作业。
chore(release)

当前我的配置如下:

deploy:
  # deploy to github release
  - provider: releases
    api_key: $GIT_TOKEN
    file_glob: true
    file: "*.vsix"
    skip_cleanup: true
    on:
      tags: false
      all_branches: true
      condition: "$TRAVIS_COMMIT_MESSAGE =~ *release*$"

如您所见,在这种情况下,我只是尝试匹配单词“ release”,但仍然不起作用。难道我做错了什么?或者也许无法匹配部分字符串?

我的测试提交消息是:

chore(release): version 1.1.6

然后在主分支(不是标签)上运行它。

日志给我以下消息:

Skipping a deployment with the releases provider because a custom condition was not met

编辑:

我也尝试过这样的事情:

deploy:
  # deploy to github release
  - provider: releases
    if: commit_message =~ /^chore\(release\)/
    api_key: $GIT_TOKEN
    file_glob: true
    file: "*.vsix"
    skip_cleanup: true
    on:
      branch: master

Travis将此注销:

  

/home/travis/.travis/job_stages:第565行:预期)' /home/travis/.travis/job_stages: line 565: syntax error near =〜'   /home/travis/.travis/job_stages:第565行:`if [[(($ TRAVIS_BRANCH =   commit_message =〜/ ^ chore(release)/)]];然后'

0 个答案:

没有答案