This question is very similar to: How can I have unique build numbers across branches with Jenkins & the Pipeline Multibranch Plugin
However what I want is not only a unique build numbers, but sequential.
Before moving to multibranch, I was creating a version number using <YYYY>.<MM>.<BuildNumber>
which would produce versions like 2020.03.789
. This would be used as the build description, and as the NuGet package version and which is created and pushed to a Nexus repo.
It's important that the version is sequential as when I create a release in our deployment system (Octopus) I want to to pick the highest package version (the latest) and not have to search for it.
I have found this blog post which describes the same problem with a solution, but I don't want to get into the realms of creating an external service and making http requests in the pipeline.
I feel like this is quite a standard requirement/strategy for building versioned packages and that there must be a way to achieve this with just Jenkins? Or am I thinking about this in the wrong way?