How do you avoid forgetting to increase the version number for your project?

I always forget to change the version number for the bugfix version when I released 1.0.9, maybe the version number in the source code is still 1.0.0

While this is not so important, since each release has been registered in SVN, I can get the specified version at any time from my SVN.

But I know that this is not good, and in the foreseeable future this may cause problems when updating the old version. I saved the version number as a parameter in my source code, I want if there is a better way to control this number, especially for the php web project (I know some other language has automatic versioning, but it seems not in php?).

How do you view this issue in your project? Any best practice?

+4
source share
6 answers

Use continuous integration software such as TeamCity , and use a script construct that takes the version number as a parameter. Your build script can simply call the small tool that it just does: open the file (versioninfo.php), find this line (some elements of the regular expression) and replace it with the given parameter.


A few additional tips to ease this: open each version that will be released soon, we now have 5.0 in production (but it is still built with the goal of fixing it), 5.1 is forked and tested at this point, and the trunk contains 5.2.

Each time you will need to release a patch, update the version number in TeamCity and in the call to the build script (which should also be done in TeamCity).

Fe At the moment we have the following projects:

  • Version 5.0.5 (which accepts / v = 5.0.5)
  • Release 5.1 (which accepts / v = 5.1)
  • Trunk (which takes / v = 5.2)

Combine this with the prefix of your SQL scripts with the version number and an automated database creating a script that creates a large script transaction for each version (for example: DPL_Updates_for_5.1.sql).

When we bring the production version, we take artifacts from the TeamCity branch, database scripts specific to this version are automatically added to the zip file, and we give the file (plus release notes, etc.) to our application management department .

+7
source

You can use plugins like Code :: Block AutoVersioning plugin , which automatically increase the build number (and / or version number).

Or (if you have too much time) you can create an SVN script that restricts the commit with the same version number ^^.

+1
source

You have a local database describing releases. Then write a script to create the release, and this can check the version number stored in your source and update the database if the release succeeds. You can even get Joel's test point!

+1
source

Make a checklist. Follow him every time you let go.

0
source

I have not used svn and php. But I saw how some people integrated the svn version directly into the php file using documentation like / ** @version $ SVN * / So when we exit the trunk of our branch to create an assembly for release. Files contain / show the current version.

0
source

Use phing to create a release package. It has a very flexible conversion, it can even automatically read the latest version of SVN.

0
source

Source: https://habr.com/ru/post/1300142/


All Articles