Reset the build number automatically (yml)
Hi guys,
I'm using the yml config at the moment, and trying to get the build numbers to reset once the major/minor versions are incremented. I know I can go into the web interface and reset it manually, but that is tedious. I want it to auto-reset when I manually change the major/minor numbers in my yml:
1.0.{0}
1.0.{1}
1.0.{2}
1.0.{3}
1.1.{0}
I understand that if you try to use a number that's already taken (not unique), the number will be auto incremented to the next available unique entry. If this is the case, could I simply specify something in my yml to reset the build number to 0, so it will start at 0 on each build, which should result in the functionality above?
I've searched the forum and Google, as well as looked through the documentation, but can't see any way to reset the build count without using the web interface.
Please advise.
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 16 May, 2014 11:57 PM
There is a better way setting build number as you want: https://www.appveyor.com/docs/build-worker-api/#update-build-details
2 Posted by JyeGuru on 17 May, 2014 02:04 AM
This seems to be a way of setting the whole version number myself, which I don't particularly want to do. I am happy with using the default 'increment by one' version numbers in these projects, at least for now, and simply changing the version header in the appveyor.yml when pushing updates hotfixes/versions/etc.
In my post, I am referring to this particular comment:
You can have "through" builds numbering in which major and minor parts of the version are changing and the build number is never reset or you can reset the build number for every new version. -- http://www.appveyor.com/docs/build-configuration#build-versioning
It would seem to indicate that there is a way to choose this behavior, which would be perfect, however I can't find anything that would suggest any entries for appveyor.yml that would influence the build number generation.
Support Staff 3 Posted by Feodor Fitsner on 17 May, 2014 10:43 PM
Oh, that phrase means you can reset build number on UI.
4 Posted by JyeGuru on 18 May, 2014 01:16 AM
Ah, I see. In that case, is it possible request adding a 'reset build number to zero' option into the yml parser?
Support Staff 5 Posted by Feodor Fitsner on 18 May, 2014 02:12 AM
Sure, what would be the trigger to reset build number to zero then?
6 Posted by JyeGuru on 18 May, 2014 02:21 AM
How about something simple like a new entry:
buildnumber: through|reset|force: #
This is presuming that it would respect the 'if not unique, then find lowest unique number' behavior that resetting it through the web interface would.
through
= current behaviorreset
= try {build}=1 and increment until unique version foundforce: #
= try {build}=# and error if version not uniquePersonally, I would just leave it on
reset
which would result in the numbering scheme in my first post (with the exception of {0} because I noticed after posting that {1} is the lowest value), however this should cover all use cases?Support Staff 7 Posted by Feodor Fitsner on 18 May, 2014 06:58 PM
Well, that's an interesting suggestion and I think it's pretty doable. I'm going to add it to issues list. Thanks!
- Feodor
8 Posted by JyeGuru on 20 May, 2014 06:58 AM
Thanks! :)
9 Posted by micdenny on 19 Aug, 2015 02:46 PM
I don't see the issue, what about this feature?
10 Posted by Chris Simmons on 19 Feb, 2016 12:25 AM
Hello Feodor, can you tell us if this feature will be added? I'm using the build number as my patch number for semantic versioning and would love it if AppVeyor would be able to detec a new major or minor version and reset the build number to 0. I think Yuki Hyou's solution above would be perfect, except for reset, the initially-tried value would be 0 and not 1.
Support Staff 11 Posted by Feodor Fitsner on 21 Feb, 2016 01:51 AM
We've added a new REST API method to update next build number: http://www.appveyor.com/docs/api/projects-builds#update-project-bui...
12 Posted by Benjamin Abt on 21 Sep, 2016 07:56 PM
Is it possible right now to auto reset the build number? a rest api call is not automatically integrateable in open source projects.
My request:
If I increase Major or Minor the Build number should be reset automatically to 0.
Optional property of yml like Yuki Hyou here said in 2014.
13 Posted by bazzilic on 19 Jun, 2017 09:38 AM
I would also like this feature to be available through YAML config
14 Posted by Daniel Wilches on 07 Jul, 2017 08:36 PM
The optional property in the yml would be useful to me too. We already manipulate the yml when doing releases to force the major/minor version number, but doing an API call means we need to code an extra step somewhere in our pipeline.
For future generations though ...
15 Posted by ericnewton76 on 27 Dec, 2017 09:55 PM
+1 for me.
Although this would work perfectly for many:
appveyor.yml:
buildnumber:
#reset build number on a tag build
resetOnTag: 0
16 Posted by ericnewton76 on 27 Dec, 2017 09:58 PM
Could this be added to the Powershell cmdlets?
sample appveyor yml:
on_init:
- ps: if($env.APPVEYOR_REPO_TAG -eq "true") { Set-BuildNumber 0 }
17 Posted by niveus_everto on 22 Mar, 2018 04:37 PM
Any updates on this?
18 Posted by salaros on 17 Jun, 2018 04:04 PM
@niveus_everto
Hey, I reset the build number of one of my projects in order to have -preview1, -preview2 and so on
on the next non-tagged builds, until the next tagged build.
I think you can adapt it for your needs:
Power shell script:
P.S. Please note APPVEYOR_TOKEN variable contains an encrypted API token. You can find your AppVeyor API key here
Owen McDonnell closed this discussion on 27 Jun, 2019 05:24 AM.