Deploy only when changeset has tag.

Patrick Schimmel's Avatar

Patrick Schimmel

15 Apr, 2021 07:25 PM

Hi! I want to control the creation of Nuget packages and Github releases only on certain conditions e.g. when the changeset is tagged. I usually create tags using the Git UI integrated in Visual Studio.

I tried different settings and also followed the explaination here:
https://help.appveyor.com/discussions/problems/5624-deployment-with-appveyor_repo_tag-dont-work
by removing the braches only setting, but did not succeed.

Here's a link to my repo and appveyor.yml file:
https://github.com/pschimmel/ES.Tools/blob/master/appveyor.yml

There seems to be someting that I'm missing.

  1. 1 Posted by Patrick Schimme... on 15 Apr, 2021 07:27 PM

    Patrick Schimmel's Avatar

    The usual error messages that I get is:
    "NuGet" deployment has been skipped as environment variable has not matched ("APPVEYOR_REPO_TAG" is "false", should be "true")
    "GitHub" deployment has been skipped as environment variable has not matched ("APPVEYOR_REPO_TAG" is "false", should be "true")

  2. Support Staff 2 Posted by Feodor Fitsner on 15 Apr, 2021 10:49 PM

    Feodor Fitsner's Avatar

    You have branch filter that allow master branches only:

    branches:
      only:
        - master
    

    This prevents AppVeyor from starting tag builds at all. Remove that filter or add Regexp specification for tag names, for example:

    branches:
      only:
        - master
        - /v\d+\.\d+\.\d+/
    
  3. 3 Posted by Patrick Schimme... on 25 Apr, 2021 07:29 PM

    Patrick Schimmel's Avatar

    Hi Feodor,

     

    Thank you for your help. I’m still struggling with my settings.

    What I basically want to do is to have two branches.

    master and development.

    Whenever I push to master branch, I want appveyor to check the build and run the tests.

    Whenever I push to master branch with a certain version tag, I want appveyor to deploy the nuget packages to the nuget server and create a new github release.

     

    In my appveyor.yml file, I set the version to a fixed version number, without build number, because I prefer to get nuget files that use naming convention without the build number like ES.Tools.0.6.6.nupkg and something like ES.Tools-0.6.6 as version number for the Github release.

     

    It’s ok if I have to modify the version number in appveyor.yml manually before each release.

     

    However, with my settings I get failing appveyor builds with the following message:

    Build version 0.6.6 already existed and a random string was appended to its version to avoid collision. Update next build number or change version format.

    I assume this is because each version number is the same.

     

    Alternatively, if possible, I could use a version tag name as part of the nupkg file and Github release, but I don’t know how to configure that.

    I tried a couple of different approaches, but every time, I end up getting either the error message described above, or I get for example a github release name of ES.Tools-{version}.

     

    I hope you can give me some tips how to accomplish that or if there is a better “best practice” for the deployment.

     

    All the best,

    Patrick

  4. Support Staff 4 Posted by Feodor Fitsner on 26 Apr, 2021 05:03 PM

    Feodor Fitsner's Avatar

    Hi Patrick,

    This is a good example: https://github.com/pglet/pglet-powershell/blob/main/appveyor.yml

    It publishes PowerShell module and NuGet packages on tag pushes only and it grabs version from a tag name. In all other builds it just works with AppVeyor's internal version number. Hope that helps.

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