Sting replace in appveyor.yml

Bjarte Djuvik Næss's Avatar

Bjarte Djuvik Næss

08 Sep, 2018 05:08 AM

I create my version in appveyor using the following template

version: 1.0.{build}-{branch}

Since we use slashes in the branch name, we get a version like "1.0.1-feature/my-nice-feature". This causes an issue when deploying to Octopus, since it requires a valid Semantic Version, which means the "/" is not allowed.

Is there a way to reformat the branch name in appveyor.yml?

I´m looking for something like

version: 1.0.{build}-{branch.replace("/","-")}

Here is my (almost) my full appveyor.yml

version: 1.0.{build}-{branch}
image: Visual Studio 2017
before_build:
  - ps: nuget restore .\Foo.sln
build:
  project: ./Foo.sln
  publish_wap_octopus: true
  verbosity: minimal
test: off
deploy:
  - provider: Octopus
    push_packages: true
    create_release: false
    deploy_release: false
    server: https://foo.octopus.app
    deploy_wait: false
nuget:
  account_feed: true
  1. Support Staff 1 Posted by Ilya Finkelshte... on 10 Sep, 2018 04:17 PM

    Ilya Finkelshteyn's Avatar

    You can update it using Update-AppveyorBuild command and APPVEYOR_BUILD_VERSION environment variable at init stage. It can look like this:

    init:
    - ps: Update-AppveyorBuild -Version $env:APPVEYOR_BUILD_VERSION.Replace("/","-")
    

    Downside of this approach is described in this issue, which should be fixed in near time though.

  2. Ilya Finkelshteyn closed this discussion on 10 Sep, 2018 04:17 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