Build Stages: Deploying to Rubygems

This example has 2 build stages:

  • Two jobs that run tests against Ruby 2.2 and 2.3 respectively
  • One job that deploys (releases) the gem to rubygems.org

Here’s what the .travis.yml config could look like:

rvm:
  - 2.2
  - 2.3

script: echo "Running tests against $(ruby -v) ..."

jobs:
  include:
    - stage: gem release
      rvm: 2.2
      script: echo "Deploying to rubygems.org ..."
      deploy:
        provider: rubygems
        gem: travis-build-stages-demo
        api_key: $RUBYGEMS_API_KEY
        on: deploy-gem-release

This is how the build matrix would look:

image

You can find the code for this example on our demo repository: