Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Teamcity 9: How to add git short hash into assembly info patcher

I'm trying to use assembly info patcher to create a version number something like:

1.2.3.1a3c19e

where the last bit is the git short hash.

I've tried using a powershell script build step to create the short hash (as I cant find a variable that has it) and adding this to a system variable but this build step appears to run after assembly info patcher, so isn't much use.

like image 433
Neil P Avatar asked May 23 '15 19:05

Neil P


1 Answers

If you want to write this to the Assembly Info field it can be done, but it requires a separate build configuration to generate the build number. The sole purpose of this step is to create the build number that has the hash appended to it.

1. Create a build configuration to generate the short hash

Build Config

2. Add a step to generate the hash

Build Config

3. Add a parameter to store the hash

Param

4. Add a second build configuration and add a dependency to the first one

Dependency

5. You can now consume the parameter in the dependent step

Consume

6. At this point you can use it in the assembly info patcher

Patcher

The alternative to this is to write your build number back to Git using the VCS labeling build feature.

Labeling

Hope this helps.

like image 75
Evolve Software Ltd Avatar answered Sep 22 '22 16:09

Evolve Software Ltd