Перейти к содержимому

Automating VSTS extensions publishing via TeamCity

This blog post covers of  extension publishing with 🙂

First of all, word of warning:
Be extra careful, when creating publisher in https://marketplace.visualstudio.com/ if you are member of several AAD - it is not as straightforward as one could expect. I ended up with one publisher, created from one of my AAD tenants (despite of being authorized at MSFT account - there is a dropdown to select tenant). This is a problem - I have not had VSTS account with these tenant, so I was not able to automate things (I created token, but token was from MSFT user, not AAD tenant user). I ended up requesting support for help - they added my MSFT login to my publisher.

Now, step by step guide on how to setup Teamcity build.

  1. Install Teamcity.Node plugin
  2. Extension version are patched on Teamcity level (so, does not need to keep in mind necessity to bump up those numbers, though, he have to inform or update Major version in case there is breaking changes)
    I am using "VCS labeling" feature of Teamcity to put tag of successful builds and "File content replacer" feature to replace versions in vss-extension.json and task.json. This way, Teamcity will always bump up version in both files before creating extension vsix package.
    I was experimenting with several regexps (so, this is not single point of truth, but useful start for your own implementations)
  3. Build steps:
    1. NPM from Teamcity.Node plugin
    It installs tfx-cli and updates it with following commands:
    "install -g tfx-cli
    up -g tfx-cli"
    2. Command line
    It invokes tfx to publish my extension
    "tfx.cmd extension publish -t %access.token% --manifest-globs vss-extension.json --no-color --no-prompt"

Some additional findings