Tags creates request but doesn't trigger a deploy job

Hi,

We use Travis to build and deploy artifacts to Maven Central. The repository has 2 branches:

  • master - Builds on JDK 8
  • 9.0.0 - Builds on JDK 11

In order to define a different JDK, we use the following matrix:

matrix:
  fast_finish: true
  include:
    - jdk: oraclejdk8
      if: branch = master
    - jdk: openjdk11
      if: branch = 9.0.0

For every commit made to either of these branches, we build and deploy a snapshot to Maven Central.

For every tag pushed to either of these branch, we want to build and release to Maven Central.

deploy:
  # Deploy snapshots on every commit made to master and 9.0.0 branch
  - provider: script
    script: ./gradlew uploadPublished -PsonatypeUsername=$SONATYPE_USERNAME -PsonatypePassword=$SONATYPE_PASSWORD
    skip_cleanup: true
    on:
      tags: false
      all_branches: true

  # Deploy releases on every tag push
  - provider: script
    script: sh .ci/deploy.sh
    skip_cleanup: true
    on:
      tags: true

When a commit is pushed to any of these branches, it works fine. However, when we push tags, build isn’t triggered. The request is received by Travis and a request message can be seen in Travis web dashboard: “Build config did not create any jobs”.

Github Repo: https://github.com/controlsfx/controlsfx
Travis Repo: https://travis-ci.com/controlsfx/controlsfx

Failed Tag: https://github.com/controlsfx/controlsfx/commit/c60656b4f360d530b17ef49663a853f76807035b

I am new to this community. If the question has something missing, please suggest. I will try my best to add it.

In https://travis-ci.com/controlsfx/controlsfx/requests, you see that the build request for the tag v8.40.16 was rejected because it did not create any job. The tag appears to have been removed on GitHub, but in https://github.com/controlsfx/controlsfx/blob/4e7a4627c4a9d1712350e11fedb21defced0fb1f/.travis.yml, you see that both of the two jobs in the matrix.include section have an if condition that are not met.

Deployments are run within a job, so you will have to create at least one job.

@BanzaiMan Is appending the matrix condition with tag check enough to create a job when tags are pushed?

matrix:
  fast_finish: true
  include:
    - jdk: oraclejdk8
      if: branch = master OR tag =~ ^v8\.[0-9]+\.[0-9]+ #Match v8.40.16
    - jdk: openjdk11
      if: branch = 9.0.0 OR tag =~ ^v[0-9]+[0-9]+\.[0-9]+\.[0-9]+ #Match v11.0.0

It appears promising to me.

1 Like
Imprint