I need to add the ability to a phing build to:
- Parse an existing xml file within the project area to get an existing build number (in format 1.2.3)
- Ask the user what type of 'change' this is (i.e. major, minor, fix)
- Based on the response of the user at the time of run, upgrade the respective digit from the build number (if major increase 1 by 1; if minor increase 2 by 1; if fix increase 3 by 1)
- Store the build number back into the original xml file
- Have the new build number available for use when naming a zip file (later in the build).
Wondering if anyone already has a phing build file that does something like this or if you happen to know what phing tasks might help with these steps?
As a starting point you could do it without overhead using the version task (it uses a property file to store the version information) or with some more effort from a xml file.
The following example build script (documentation links can be found in the description attributes) contains both ways.