Tagging a GitHub release results in an error, and the release publishes without the file

Every time Travis CI deploys my release to GitHub Releases, it keeps throwing an error, but the release gets published without the file.
Here’s the command that puts the tag into a variable:

$ export TRAVIS_TAG=${TRAVIS_TAG:-$(date +'%Y%m%d%H%M%S')-$(git log --format=%h -1)}

It doesn’t have any errors. But when I run git tag $TRAVIS_TAG, it says:

fatal: tag '20190619170744-beeb4ba' already exists

The release still published with the tag I wanted, but didn’t include any files (I made sure that skip_cleanup was set to true). How do I fix this error?

Here’s the full .travis.yml file:

language: node_js
node_js:
  - lts/*
before_install:
  - npm i -g web-ext
  - git config --local user.name "[omitted]"
  - git config --local user.email "[omitted]"
  - export TRAVIS_TAG=${TRAVIS_TAG:-$(date +'%Y%m%d%H%M%S')-$(git log --format=%h -1)}
  - git tag $TRAVIS_TAG # the error happens when this command is run
script: rm ./README.md ./LICENSE ./index.html ./_config.yml && web-ext build
deploy:
  provider: releases
  api_key: "$STUFF"
  file: "ComicXL.zip"
  skip_cleanup: true
  on:
    tags: true

When reporting a problem, it is tremendously beneficial to have a link to the entire build.

Thanks.

1 Like

No need to do any of that. When you create a tag in Github repo, Travis builds it like any other branch. And Travis itself sets $TRAVIS_TAG for such a build, you don’t need to (and shouldn’t) set it yourself.

Looks like you are trying to release every build. For example, https://travis-ci.org/bhargavgv/comicxl/builds/547905241 succeeds, and creates a release https://travis-ci.org/bhargavgv/comicxl/builds/547905241#L536 (because the tags: true condition is met) with the tag 20190619203812-3e5c12b, which was defined by https://github.com/bhargavgv/comicxl/blob/3e5c12b2535220abf8ccbd6e3f5df34e7a19b6fa/.travis.yml#L8. This triggers a tag event, which triggers this build https://travis-ci.org/bhargavgv/comicxl/builds/547905812, which will fail when you try to apply the same tag.

What is your goal? Do you really need to create a release for every single successful build?

I’m making a browser extension, and I want it to make a release so that the extension file is ready whenever I want to submit it to the add-on galleries, without having to download it to my computer and build it there.

I removed both of those lines, and now the build passes, but it doesn’t create a release.
I pasted both of those lines from the documentation.

What https://docs.travis-ci.com/user/deployment/releases/#setting-the-tag-at-deployment-time means is that the pages deployer needs the current commit to be tagged.

Normally, you create a tag in Github repo whenever you wish to make a release – when building the tag, the current commit is already tagged. By creating a tag yourself, you can release under some different logic.

Yes, the instructions are unclear about that (perhaps whoever wrote them was afraid to get too technical). You can use the “Improve this page on GitHub” link at the top of the documentation page to suggest better wording.

Imprint