admin管理员组文章数量:1356716
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
本文标签: javascriptHow to have TeamCity update the build version number in a specified fileStack Overflow
版权声明:本文标题:javascript - How to have TeamCity update the build version number in a specified file? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744059588a2583881.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论