It is common to show users of a web site when the site was last published, typically by incrementing a build/revision number, or displaying a "last published" date. There are a variety of ways this can be achieved: from manually updating the date on the web server to reading from external data storage such as a file or database to display the value. With BuildMaster, it can be integrated as part of the build and deploy process.
Let's say our website has one extremely simple page:
<!DOCTYPE html> <html> <head> <title>Simple Website</title> </head> <body> Version: [[unpublished]] </body> </html>
On a local workstation, the page outputs exactly what you would expect:
Version: [[unpublished]]
Use a General block to set server context this allows you to specify server(s) that will be searched.
Now assuming we have an application with a release created in BuildMaster, we just need to add an action that manipulates the file (or files if necessary) to replace any [[unpublished]] placeholders with the actual BuildMaster release & build number.
We can do this with the Search/Replace File Contents operation. When executed, this operation will replace all instances of the specified text with a designated value.
In this case, use a built-in BuildMaster variable combination of $ReleaseNumber.$ReleasePackageNumber. When it comes time for deployment, this variable combination will be replaced with the BuildMaster release number, a literal period, then the current package number. The **.html means that all files and subfiles that are .html will be searched.
In my demonstration plan, I copy the files to the BuildMaster default directory, run the replacement, then copy the replaced file to an "output" directory on my machine.
When you execute a build, the C:\Test\html\example.html file will be copied into the default directory, the [[unpublished]] text will be replaced with the current release & build numbers, and the output will be copied into C:\Test\html-replaced\example.html. Here is a simple diff between the two files that were built under release 6.3, build #3:
Use $Date("MM-dd-yyyy") (where MM-dd-yyyy is any valid .NET date/time format string) instead of $ReleaseNumber.$BuildNumber and create a new build: