Creating a text file in the root of site deployed with version number

Just mastering the release process and after some advice on the best way to acheive this?

I want to get a text file into the root of my website with the release version number in. The idea behind this is to be able to see the version of the site that is in use as we run a blue green setup.

I want to be able to browse to mydomain.com/version.txt and see what version (as well as possibly some other info) is currently live.

thanks in advance

Hi John,

Thanks for getting in touch! You could add a script step to your process, using some PowerShell to create the text file. Within it, you can add the content you need using the system variable Octopus.Release.Number within it. Something like the following (using variable substitution syntax):

New-Item -Path "" -Name "version.txt" -ItemType "file" -Value "#{Octopus.Release.Number}"

I hope this helps! Let me know how you go or if you have any further questions moving forward. :slight_smile:

Best regards,

Kenny

1 Like

That’s great, just tested it and it does the job.

Added in a couple of project variables and managed to get a test file that we will use in our blue/green deployment setup.

Thanks for the assistance

Hi John,

That’s awesome to hear it works for you! You’re very welcome, and please don’t hesitate to reach out if you have any further questions or concerns moving forward. :slight_smile:

Best regards,

Kenny

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.