TeamCity:使用工件的文件版本标记 VCS(Subversion) [英] TeamCity: labeling VCS (Subversion) with an artifact's file version

查看:12
本文介绍了TeamCity:使用工件的文件版本标记 VCS(Subversion)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 SVN 中创建一个带有文件版本的标签(标签).

I want to create create a label (tag) in the SVN with a file's version.

我已经通过获取构建生成的主要可执行文件的文件版本来重命名工件.如:MyInstaller-1.2.3.1.exe.现在我想在 SVN 中创建一个名为 /tags/1.2.3.1 的标签.我找不到在标签模式中设置这种东西的方法.

I'm already renaming the artifact by getting the file version of the main executable produced by the build. Such as: MyInstaller-1.2.3.1.exe. Now I want to create a tag in the SVN called /tags/1.2.3.1. I couldn't find a way to set such a thing in the labeling pattern.

目前我的标签只是%system.build.number%"

Currently my labeling is just "%system.build.number%"

你知道怎么做吗?

我正在使用 TeamCity 专业版 4.5.3(内部版本 9035)

推荐答案

正如有人提到的,您可以在构建脚本执行期间输出构建号,而 teamcity 将使用该输出来标记构建.例如,我使用放入 AssemblyInfo.cs 的相同版本标记我的构建.该版本的一部分(主要,次要)实际上已经在文件中,另一部分(构建,修订)在构建期间添加.

As someone mentioned, you can output the build number during the execution of the build script, and teamcity will use that output to label the build. For example, I label my build with the same version that I put into AssemblyInfo.cs. Part of that version (Major, Minor) is actually in the file already, the other part (Build, Revision) gets added during the build.

来自我的 msbuild 脚本:

From my msbuild script:

<Target Name="Setup">
    <!-- Version.txt contains the major and minor version numbers, 
         The build number and revision come from environment variables
         in the next step -->
    <Version VersionFile="Version.txt" BuildType="None" RevisionType="None">
        <Output TaskParameter="Major" PropertyName="Major" />
        <Output TaskParameter="Minor" PropertyName="Minor" />
    </Version>

    <!-- If you want to build a release without going through the build
         server, you should define the following 2 environment variables
         when running this build script -->

    <!-- BUILD_NUMBER environment variable supplied by the build server -->
    <CreateProperty
        Value="$(BUILD_NUMBER)">
        <Output
            TaskParameter="Value"
            PropertyName="Build" />
    </CreateProperty>

    <!-- BUILD_VCS_NUMBER environment variable supplied by the build server -->
    <CreateProperty
        Value="$(BUILD_VCS_NUMBER)">
        <Output
            TaskParameter="Value"
            PropertyName="Revision" />
    </CreateProperty>       

    <AssemblyInfo CodeLanguage="CS"  
        OutputFile="PropertiesVersionInfo.cs" 
        AssemblyVersion="$(Major).$(Minor).$(Build).$(Revision)" 
        AssemblyFileVersion="$(Major).$(Minor).$(Build).$(Revision)" />

    <!-- Tell the build server what our actual build number is -->
    <Message Text="##teamcity[buildNumber '$(Major).$(Minor).$(Build).$(Revision)']" />
</Target>

您只是在构建期间输出版本,格式为 ##teamcity[buildNumber '<buildnum>']

you just output the version during the build the format is ##teamcity[buildNumber '<buildnum>']

这篇关于TeamCity:使用工件的文件版本标记 VCS(Subversion)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆