Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis deploy based on matrix parameters

I have a travis job that runs on both Linux and OSX, which I would like to be able to use to deploy different build artefacts for each platform to github releases. My .travis.yml file currently looks something like this:

language: rust

cache: cargo

os:
  - linux
  - osx

rust: 
  - stable
  - beta
  - nightly 

script: 
  - cargo build --release -vv
  - cargo test --release --all -vv

matrix:
  allow_failures:
    - rust: nightly
  fast_finish: true

deploy:
  - provider: releases
    skip_cleanup: true
    api_key:
      secure: <encrypted key here, removed for brevity> 
    before_deploy: 
      - cargo install cargo-deb
      - cargo deb --no-build --no-strip
      - ./scripts/package_linux.sh .
    file_glob: true
    file: 
      - "target/debian/ellington_0.1.0_amd64.deb"
      - "releases/*_linux.zip"
    on:
      tags: true
      os: linux
      rust: stable

I assume that I add a second deploy step (e.g. see below), but I can't find any documentation on how to do this, let alone whether it's even possible. There is extensive documentation on deploying to multiple providers, but not on deploying multiple times to the same providers on different platforms.

  - provider: releases
    skip_cleanup: true
    api_key:
      secure: <encrypted key here, removed for brevity> 
    before_deploy: 
      - ./scripts/package_osx.sh .
    file_glob: true
    file: 
      - "releases/*_osx.zip"
    on:
      tags: true
      os: osx
      rust: stable
like image 984
AdamHarries Avatar asked Jul 27 '18 23:07

AdamHarries


People also ask

What is build Matrix?

A build matrix is made up by several multiple jobs that run in parallel. This can be useful in many cases, but the two primary reasons to use a build matrix are: Reducing the overall build execution time. Running tests against different versions of runtimes or dependencies.

Which of the following provides are supported by Travis CI?

Continuous Deployment to the following providers is supported: anynines. AWS CloudFormation. AWS CodeDeploy.


1 Answers

Check out this link!

The gist of it is yes, you were on the right track and you can define multiple deployments like so:

deploy:
    - provider: releases
      api_key: "<deploy key>"
      file:
        - "target/release.deb"
      skip_cleanup: true
      on:
        tags: true

    - provider: releases
      api_key: "<deploy key>"
      file:
        - "target/release.dmg"
      skip_cleanup: true
      on:
        tags: true

    - provider: releases
      etc...

Relevant documentation for this feature can also be found here. approximately halfway through the conditional deployment section.

like image 151
Sam Gomena Avatar answered Sep 29 '22 10:09

Sam Gomena