Force Pre-release version number in branch

Allan's Avatar

Allan

02 Jan, 2019 10:04 AM

Hi,
New to yml files and AppVeyor but so far the experience has been awesome. My question relates to how I can setup the version number depending on the branch type. e.g. master always builds release versions, but any other branch will change the patch and append a pre-release value so that when the nuget package is built, it deploys to NuGet.org and will be displayed as a pre-release package.
I don't want to manually have to change the file version or package versions as part of checkins, etc.
Is this possible, can someone help with the yml too?
thanks in advance.

  1. Support Staff 1 Posted by Owen McDonnell on 02 Jan, 2019 05:29 PM

    Owen McDonnell's Avatar

    Hi, Allan.
    It's hard to give too specific advice without seeing your current configuration file but you can find information about using the build worker API to alter build details here.
    You could combine that with some logic that checks for the value of APPVEYOR_REPO_BRANCH (one of the environment variables set by AppVeyor for every build) and renames version accordingly.
    Or, instead of including logic to determine which branch is building, you could make use of conditional build configuration as described in this blog post.
    Here is a hypothetical example.

    for:
    -
      branches:
        only: master
      before_build:
        - appveyor UpdateBuild -Version <release-version>
    -
      branches:
        only: /dev-.*/
      before_build:
        - appveyor UpdateBuild -Version <pre-release-version>
    

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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