Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you avoid forgetting to increase version number for your project? [closed]

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

So far it is not a big matter as every release was logged in SVN, i can retrieve a specified release anytime from my SVN.

But i know its not good, and in foreseeable furture it may cause problem when upgrading an old version. I stored the version number as a parameter in my source code, i wanna if there is a better way to control this number, especially for php web project (i know some other language has auto version generation, but seems no in php?).

How do you cover this problem in your project? Any best practice?

like image 534
Edward Avatar asked Jan 23 '23 15:01

Edward


1 Answers

Use continuous integration software like TeamCity, and use a build script that accepts the version number as a parameter. Your build script may just call a little tool that just does: open a file (versioninfo.php), search this string (some regex stuff), and replace it with the given parameter.


Some additional hints for making this more easy: Branch every version that is soon to be released, we have 5.0 on production right now (but it's still built for the purpose of hotfixing), 5.1 is branched and is tested at this point, and the trunk contains the 5.2.

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

F.e. We have the following projects at this point:

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

Combine this with prefixing your SQL scripts with the version number, and an automated database generating script, that creates a big transaction script per version (like: 'DPL_Updates_for_5.1.sql').

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

like image 156
Jan Jongboom Avatar answered Jan 29 '23 07:01

Jan Jongboom