Avoid the Duplicate AppVeyor Publish: Deploying Only a Single Build

Written by Ken Dale

Sometimes it’s useful to ensure a project works with multiple versions of runtimes. In the following example, multiple versions of Node.js will be used to ensure a project builds successfully with both. In these cases, you may only want a single deployment — rather than deploying twice unnecessarily.

To perform only a single build one can use an environment variable. See the following appveyor.yml example:

environment:
  matrix:
    - nodejs_version: STABLE
      publish_build: true
    - nodejs_version: LTS

#
# Any necessary build configuration here
#

deploy:
  - provider: Environment
    name: My Provider
    artifact: WebPackage
    app_name: my-application
    app_password:
      secure: TheSecurePassword
    on:
      branch: master
      publish_build: true

publish_build is an environment variable, which ensures that the above deployment only happens for the nodejs_version: STABLE build.

Published June 29, 2017 by

undefined avatar
Ken Dale Senior Application Developer (Former)

Suggested Reading