在下面的travis配置文件中,我分为两个阶段。
我打算仅通过在deploy
分支上使用条件构建功能来运行master
阶段,但是deploy
阶段仍在其他分支上运行。
除主分支外,如何跳过deploy
阶段?
language: java
services:
- docker
before_cache:
<cache clearning>
cache:
directories:
<cache directories>
stages:
- test
- name: deploy
if: branch == master
docker_login:
before_script:
<before command here>
jobs:
include:
- stage: test
script:
<test command here>
- stage: deploy
before_script: *docker_login
name: build docker
script:
<deploy command here>
已更新
我必须进行如下更改
if: branch == master AND (NOT (type IN (push, pull_request)))
答案 0 :(得分:0)
deploy
阶段在对基本存储库的拉取请求上运行,但在main
分支的分支上运行。if: branch = master AND type = push AND fork = false