TeamCity:使用工件的文件版本标记 VCS (Subversion)

发布于 2024-07-26 04:51:00 字数 326 浏览 7 评论 0原文

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

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

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

关于如何做到这一点的想法?

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

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

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.

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

Any idea about how to do this?

I'm using TeamCity Professional Version 4.5.3 (build 9035)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

榆西 2024-08-02 04:51:00

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

从我的 msbuild 脚本中:

<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="Properties\VersionInfo.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 '']

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.

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="Properties\VersionInfo.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>

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

人│生佛魔见 2024-08-02 04:51:00

如果您使用 Ant,也许您应该获取 SVNAnt.jar 并尝试 这个

我见过的标签约定是major.minor.svn(如果您使用CI,则为.build)。

If you're using Ant, maybe you should get SVNAnt.jar and try this.

The convention that I've seen for labeling is major.minor.svn (and .build if you're using CI).

薆情海 2024-08-02 04:51:00

您可以将 SVN 修订号包含到您的 TeamCity 内部版本号中。
对于 Teamcity 中的内部版本号模式,请在内部版本号模式字段中使用类似 {build.vcs.number.1} 的内容。

之后,内部版本号将包含实际的 SVN 修订号,并且您的标签模式 %system.build.number% 也将包含它。

希望这可以帮助,
基尔

You can include SVN revision number to your TeamCity build number.
For your build number pattern in Teamcity, use something like {build.vcs.number.1} in the build number pattern field.

After that build number will contain actual SVN revision number, and your labeling pattern %system.build.number% will contain it as well.

Hope this helps,
KIR

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文