Different versioning and deployment per branch
I have following (supposedly, very common) scenario. I am developing a NuGet package, and I want to separate CI and stable packages. Intended workflow is:
When somebody pushes a commit to master, AppVeyor
- picks it up, fires up a build
- sets version to [current version].{buildnumber}-ci
- builds, tests, assembles a .nuget
- pushes to nuget.org
When somebody pushes a commit to release, AppVeyor
- picks it up, fires up a build
- sets version to [version specified for release].{buildnumber}
- builds, tests, assembles a .nuget
- leaves it in artifact repository for manual deployment
In short, I'd like to be able to:
-
setup manual deployment for one branch and automatic deployment for another
As far as I understand, that's already possible by using conditional deployment
-
setup different assembly versioning patterns for different branches
As far as I understand, this could only be done with conditional build configuration, which could only be done in appveyor.yml and involves copying common setup for all branches.
-
build only the branch that triggered the build
That, too, is possible by combining default branch/branch whitelisting, but to setup differently for each branch, it'd require appveyor.yml as specified above.
(...or of course it could all be done with two different build projects, but it, too, involves copying setup, and feels untidy)
Is there something you'd recommend me?
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
Support Staff 1 Posted by Feodor Fitsner on 03 Nov, 2014 09:48 PM
In general, everything you described here is correct. You should give it a try and let me know if there any issues. Also, if you get an idea how configuration process for such scenario could be improved/simplified feel free to share your thoughts.
2 Posted by lair on 04 Nov, 2014 03:51 PM
I'll try using conditional build configuration, but here's what I think about simplifying my use-case scenario:
There's also another thing that I think could be helpful: the possibility to export current UI configuration as an
appveyor.yml
file.3 Posted by lair on 04 Nov, 2014 06:09 PM
Oh, there seems to be a further problem. Build version format does not allow for postfixes (like
2.0.{build}-pre
), so either it should be changed, or version conditioning should also apply to AssemblyInfo patching.Support Staff 4 Posted by Feodor Fitsner on 04 Nov, 2014 06:41 PM
Yeah, AssemblyVersion attribute doesn't accept semver format. Do you have an idea how to better deal with that?
5 Posted by lair on 04 Nov, 2014 06:49 PM
There's no way to deal with this (Microsoft works around that by using
AssemblyInformationalVersion
).And am I right that you can't allow pre- or postfixes in AppVeyor build version because you want it to be directly translatable to
AssemblyVersion
?And why does build version have to be unique (as stated in Build versioning)?
6 Posted by lair on 04 Nov, 2014 09:09 PM
I am sorry for not paying attention. Documentation says:
Which means that AppVeyor behaves the way I wanted ("build only the branch that triggered the build") by default (and that's the only behaviour). So no change is required there; but the ability to specify different versioning patterns for different branches is still needed. I'll try to think about the easiest way to deal with that.
7 Posted by lair on 05 Nov, 2014 11:23 AM
I could see two different (and not mutually exclusive) solutions here.
Option 1
We could add a possibility to specify different build versions for different branches (e.g:
release
branch -1.0.{build}
,develop
-2.0.{build}
, all the others -1.5.{build}
). There are, again, two options to solve the problem with semver:AssemblyVersion
andAssemblyFileVersion
AssemblyInformationalVersion
(something like{version}{postfix}
, postfix being set up as empty forrelease
and-ci
formaster
)Option 2
I just remembered that omnipresent comment from
AssemblyInfo.cs
:We could "teach" AppVeyor to replace
*
inAssemblyVersion
andAssemblyInformationalVersion
with build number (and we will have to replaceAssemblyFileVersion
withAssemblyVersion
). This way we will get:Support Staff 8 Posted by Feodor Fitsner on 13 Nov, 2014 04:58 AM
Thanks for your thoughts!
Just to summarize, I think the following is pretty doable in AV:
1) Strip anything after dash from patch number to use within
AssemblyVersion
andAssemblyFileVersion
attributes.2) If
*
is found inAssembly{something}Version
attribute replace it with build number and do not use version template defined for the project.Will add a new item for that:
9 Posted by lair on 13 Nov, 2014 08:20 AM
Thanks a lot. Am I right that
appveyor.yml
?Support Staff 10 Posted by Feodor Fitsner on 13 Nov, 2014 08:11 PM
We'll change UI validation to accept postfixes and yes different branch version templates will be in YML only (and it's available even today).
Frankly, UI wasn't designed around multi-branch configurations - this is bad and we are going to re-think it as some point.
11 Posted by lair on 13 Nov, 2014 09:34 PM
Thank you for the clarification!
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:50 AM.