Have "deploy" run only once in matrix job

oliver's Avatar

oliver

12 Jan, 2018 11:15 AM

Hi.

this is related to https://help.appveyor.com/discussions/questions/16107-different-images

I want AppVeyor to run:

  • 1 job with VS2013
  • 1 job with the latest image
  • have AppVeyor to wait on Travis to complete with the tests on OSX and linux
  • I want the deploy code to run only once for all of these jobs described above

What do I need to do in the appveyor.yml file, so that only one (preferably the last) job of the matrix runs the deploy and before_deploy block?

Thanks for the help

  1. 1 Posted by Ilya Finkelshte... on 13 Jan, 2018 10:46 AM

    Ilya Finkelshteyn's Avatar

    Here you go:

  2. 2 Posted by oliver on 13 Jan, 2018 12:06 PM

    oliver's Avatar

    Precisly what I needed!
    Thanks!

    Is there a gallery for this kind of scripts of yours?

  3. 3 Posted by oliver on 14 Jan, 2018 11:30 AM

    oliver's Avatar

    Hey @Ilya.

    I just realized that the script for a job to wait on others will not do what I need.

    My appveyor.yml file contains this:

    before_deploy:
        - ps: Invoke-Build -Task Deploy


    deploy: provider: GitHub release: v$(appveyor_build_version) description: '' auth_token: secure: aaaaaaaaaaaaaaaaaaaaaaaaaaaa draft: false prerelease: false on: branch: master # release from master branch only appveyor_repo_tag: false # deploy on tag push only

    Of course I can add conditions to the powershell script, so that it will only be run in the last job...
    But what about the deployment of the release to github?

  4. 4 Posted by Ilya Finkelshte... on 14 Jan, 2018 03:04 PM

    Ilya Finkelshteyn's Avatar

    You can set some special environment variable to true as a result of waiting script. Then use that variable in deployment condition.

    Lets say you define environment variable good_to_deploy with default value false in environment section of YAML or Environment tab in UI. Then set the following in deployment settings:

        on:
            branch: master                 # release from master branch only
            appveyor_repo_tag: false        # deploy on tag push only
            good_to_deploy: true
    

    Then in the script set something like $env:good_to_deploy = $success.

    Regarding scripts gallery, we usually create GitHub gist when customers ask something often. They are here:
    https://gist.github.com/IlyaFinkelshteyn
    https://gist.github.com/feodorfitsner

  5. oliver closed this discussion on 19 Mar, 2018 12:58 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac