Multiple Nuget Deployments based on Branch

chase.florell's Avatar

chase.florell

10 Feb, 2019 11:24 PM

Here is my current YML

```
version: '{build}'
branches:
  only:
  - development
image: Visual Studio 2017
init:
- ps: Update-AppveyorBuild -Version "$(Get-Date -format yyyy.M).$env:appveyor_build_number"
dotnet_csproj:
  patch: true
  file: '**\Directory.Build.props'
  version: '{version}-pre'
  package_version: '{version}-pre'
  assembly_version: '{version}'
  file_version: '{version}'
  informational_version: '{version}-pre'
environment:
  CAKE_SETTINGS_SKIPPACKAGEVERSIONCHECK: true
build_script:
- ps: ./build -verbosity=diagnostic
artifacts:
- path: '**\FutureFlag.*.nupkg'
deploy:
- provider: NuGet
  api_key:
    secure: xxx
```

What I really want to do is continue to have the `development` branch append a `-pre` prefix to my nuget packages and publish them to nuget.org, but I'd also like my master branch to deploy to nuget.org (without `-pre`, and I'd like any PR (on Github) to trigger a build and deployment to myget.

I clearly can't do this in the ui (which is where my above YML is taken from), and so I'm wondering if it's possible with custom YML, and how I'd go about doing it?

  1. 1 Posted by chase.florell on 10 Feb, 2019 11:27 PM

    chase.florell's Avatar

    note: the reason I want this all under one project is so that I can share the build number.

  2. Support Staff 2 Posted by Ilya Finkelshte... on 11 Feb, 2019 08:48 AM

    Ilya Finkelshteyn's Avatar

    You can add two Nuget deployments, one target Nuget, another Myget (Nuget deployment with Server URL specific to Myget). Then use conditional deployment to setup which branch deploy to which deployment.

    Regarding -pre prefix is it about file name? As I understand .nupkg files are being created with build.ps1 script, so you can use APPVEYOR_REPO_BRANCH environment variable in script to rename .nupkg files when needed, e.g. add -pre prefix when APPVEYOR_REPO_BRANCH equal development.

    Hope I understood your questions correctly. If not, please elaborate.

  3. Ilya Finkelshteyn closed this discussion on 13 Apr, 2019 09:01 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