Travis deploy based on matrix parameters
Asked Answered
M

1

6

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
Mediator answered 27/7, 2018 at 23:14 Comment(0)
F
4

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.

Footworn answered 8/3, 2019 at 5:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.