Reputation: 5572
I have a LaTeX Resume hosted here with Travis CI enabled in order to generate a new PDF on every push. You can find the Travis build info here.
I have Travis set to build on push, however every push triggers two builds: one for the push and one for a tag -- even if there is no tag. You can see an example if this behavior below:
I tried setting on: tags
to false but this didn't change anything.
How can I set Travis to only build once for each push?
Here is my .travis.yml
:
before_install:
- sudo apt-get update && sudo apt-get install --no-install-recommends texlive-fonts-recommended
texlive-latex-extra texlive-fonts-extra texlive-latex-recommended dvipng
script:
- mkdir _build
- pdflatex -output-directory _build EvanOman.tex
deploy:
provider: releases
api_key:
secure: <HASHED KEY>
file:
- _build/EvanOman.pdf
skip_cleanup: true
detect_encoding: true
on:
tags: false
after_success:
"curl --ftp-create-dirs -T _build/EvanOman.pdf -u $FTP_U:$FTP_P ftp://ftp.evanoman.com/public_html/EvanOman.pdf"
Upvotes: 1
Views: 674
Reputation: 5572
It turns out the error was using deploy.provider: releases
.
What this does is trigger a deploy to the Github releases page for my repo. The problem was that if I pushed without a tag, Github would make a Draft release with an associated tag: untagged:<commit hash>
. The addition of this new tag would then trigger another Travis build, thus the two builds for every push.
Since I am just posting the resulting PDF to my website via FTP, the solution is to remove the deploy
block from my .travis.yml
. Doing so removed the multiple builds per push and Travis is now behaving as I would like.
Here is my current .travis.yml
:
before_install:
- sudo apt-get update && sudo apt-get install --no-install-recommends texlive-fonts-recommended
texlive-latex-extra texlive-fonts-extra texlive-latex-recommended dvipng
script:
- mkdir _build
- pdflatex -output-directory _build EvanOman.tex
after_success:
"curl --ftp-create-dirs -T _build/EvanOman.pdf -u $FTP_U:$FTP_P ftp://ftp.evanoman.com/public_html/EvanOman.pdf"
Upvotes: 1