
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 PUBLIC “-//W3C//DTD HTML 3.2//EN”>
<html>
<head>
<title>Simple Website</title>
</head>
<body>
Version: [[unpublished]]
</body>
</html>
On a local workstation, the page outputs exactly what you'd expect:
Version: [[unpublished]]
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 action:

This action will replace all instances of the text of your choosing with a value
of your choosing. In this case, I'll want to use a built-in BuildMaster variable
combination of %RELNO%.%BLDNO% . When it comes time for deployment,
this variable combination will be replaced with the BuildMaster release number,
a literal period, then the current build number. Here is an example action with
the options filled in:

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:

Now, when I 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:

If you wanted to use a date instead, simply use %DATE:MM-dd-yyyy%
(where MM-dd-yyyy is any
valid .NET date/time format string) instead of %RELNO%.%BLDNO%
and create a new build:

Text replacements can go beyond just version numbers and dates. BuildMaster's built-in
variable engine provides the following other variables:
- REFRELNO – If there is a referenced deployable for this application,
its release number.
- REFBLDNO – If there is a referenced deployable for this application,
its build number.
- PREVRELNO- The release number of the most recently deployed release.
- PREVBLDNO – The build number of the most recently deployed
release.
- LASTBLDNO – The most recent build number for the current
release that was created before the current build number.
- DATE1 – A timestamp in the format of YYYYMMDD.
- DATE2 – A timestamp in the format of YYYYMMDDHHMMSS.
- APPNAME – The name of the current application.
- RELNAME – The name of the release of the current build.
- ENVNAME – The environment name of the currently executing
build.
- YOUR_VARIABLE_NAME – The value of the variable with the name
YOUR_VARIABLE_NAME.