代码之家  ›  专栏  ›  技术社区  ›  simbo1905

将travis部署到具有自定义条件的标记regex上

  •  1
  • simbo1905  · 技术社区  · 8 年前

    我正试图让Travis在符合模式的标签上部署 /v.*/ ,并将环境变量设置为特定值 $GITSECRET_DIST == deb .我尝试了以下方法:

    skip_cleanup: true
        on:
          branches:
            except:
            - legacy
            - experimental
          tag: true
          condition: "$TRAVIS_TAG =~ ^v.*$ && $GITSECRET_DIST == rpm"
    

    结果在 https://travis-ci.org/simbo1905/git-secret/jobs/394177628 是:

    Skipping a deployment with the bintray provider because this branch is not permitted: v0.0.4
    

    我也试过:

    skip_cleanup: true
        on:
          branches:
            only:
            - master
            - /v.*/
          tag: true
          condition: "$TRAVIS_TAG =~ ^v.*$ && $GITSECRET_DIST == rpm"
    

    那是在 https://travis-ci.org/simbo1905/git-secret/jobs/394169491 以下内容:

    Skipping a deployment with the bintray provider because this branch is not permitted: v0.0.3
    

    我也尝试过没有任何分支规范。

    2 回复  |  直到 8 年前
        1
  •  1
  •   heldic    8 年前

    它可能不完全适合您的需要,因为它不直接在 condition 第节,共节 .travis.yml 不过,我已经详细阐述了实现这一目标的一种方法。 here .

    您应该能够根据需要修改脚本。如果您真的想使用regex,也可以在脚本中使用它,例如 this .

        2
  •  1
  •   simbo1905    8 年前

    设置 all_branches: true 工作:

    skip_cleanup: true
    on:
      all_branches: true
      tag: true
      condition: "$TRAVIS_TAG =~ ^v.*$ && $GITSECRET_DIST == rpm"