简体   繁体   中英

Travis CI build triggered twice

I am using the following config.

before_install:
  - "sudo apt-get update"
  - "sudo apt-get install --no-install-recommends texlive-full"
script:
  - pdflatex file.tex
deploy:
  provider: releases
  file:
    - file.pdf
  api_key:
    secure: "MY_API_KEY"
  skip_cleanup: true

When I do git push origin master --tags , it creates two builds in Travis. One for master branch and the other for the tag. I want to only build and deploy when a tag is present. So I added the condition in line 1 as follows:

if: tag IS present
before_install:
  - "sudo apt-get update"
  - "sudo apt-get install --no-install-recommends texlive-full"
script:
  - pdflatex file.tex
deploy:
  provider: releases
  file:
    - file.pdf
  api_key:
    secure: "MY_API_KEY"
  skip_cleanup: true

But now then it builds fine and only when the tag is present but it does not deploy. Gives the following warning:

Skipping a deployment with the releases provider because this branch is not permitted

You need to add tags: true under on in deploy section to trigger the deployment on tagging.

Here's an example of .travis.yml that triggers the deployment on tagging:

deploy:
  provider: ...
  api_key:  ...
  on:
    tags:   true

You may also trigger deployment by specifying the branch or branches in $TRAVIS_BRANCH (See documentation ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM