Reputation: 1524
I have two stages in the following travis configuration file.
I intended to run the deploy
stage only by using conditional build feature on master
branch but the deploy
stage is still running on other branches as well.
How can I skip deploy
stage except master branch?
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>
Updated
I had to change like as follows
if: branch == master AND (NOT (type IN (push, pull_request)))
Upvotes: 2
Views: 971
Reputation: 1524
deploy
stage run on pull request to base repository but it run on main
branch for fork.if: branch = master AND type = push AND fork = false
Upvotes: 1