Does anyone know of an easy way to show the build version number in an HTML/JavaScript project that uses AMD?
The version number is generated by TeamCity as part of the build process.
Here is what I mean in more details:
One of my js files (e.g. showVersion.js) has a line like this:
alert('Build version: __build_ver_placeholder__ ');
Ideally, after TeamCity pletes the build, it will plug in the actual version number for the place-holder. And the line above will bee:
alert('Build version: 2.1.0 ');
That way, the user can know the build version number by clicking a button on an HTML page which calls the alert() function.
Any idea will be greatly appreciated. Thanks.
Does anyone know of an easy way to show the build version number in an HTML/JavaScript project that uses AMD?
The version number is generated by TeamCity as part of the build process.
Here is what I mean in more details:
One of my js files (e.g. showVersion.js) has a line like this:
alert('Build version: __build_ver_placeholder__ ');
Ideally, after TeamCity pletes the build, it will plug in the actual version number for the place-holder. And the line above will bee:
alert('Build version: 2.1.0 ');
That way, the user can know the build version number by clicking a button on an HTML page which calls the alert() function.
Any idea will be greatly appreciated. Thanks.
Share Improve this question asked Feb 7, 2014 at 7:01 user3239076user3239076 853 bronze badges 2- Is version no an environment variable? – Adarsh Shah Commented Feb 8, 2014 at 14:08
- You have to write a script to update your files. – Aleš Roubíček Commented Feb 10, 2014 at 8:08
1 Answer
Reset to default 11You can simply add PowerShell build step containing the following code:
(Get-Content "showVersion.js")
| Foreach { $_ -Replace "__build_ver_placeholder__", "%build.number%" }
| Set-Content "showVersion.js";
%build.number% variable will be replaced by TeamCity during the build