TravisCI: Run after_success on a specific branch

前端 未结 1 1205
悲&欢浪女
悲&欢浪女 2021-02-12 07:36

I would like to know how to run an after_success script only for a specific branch.

I am using a custom script to deploy the app after build passes. I would

1条回答
  •  生来不讨喜
    2021-02-12 08:02

    I solved it by writing a simple script using TRAVIS_BRANCH environment variable and executed the script in after_success

    .travis.yml

    after_success:
    - ./deploy.sh
    

    deploy.sh

    #!/bin/bash
    if [ "$TRAVIS_BRANCH" == "prod" ]; then
      // do the deploy
    fi
    

    0 讨论(0)
提交回复
热议问题