4

ファイルのバージョンを使用して、SVN にラベル (タグ) を作成したいと考えています。

ビルドによって生成されたメインの実行可能ファイルのファイル バージョンを取得することで、既にアーティファクトの名前を変更しています。のような: MyInstaller-1.2.3.1.exe。ここで、SVN に というタグを作成したいと思います/tags/1.2.3.1。ラベル付けパターンでそのようなものを設定する方法が見つかりませんでした。

現在、私のラベルは「%system.build.number%」です。

これを行う方法について何か考えはありますか?

TeamCity Professional バージョン 4.5.3 (ビルド 9035) を使用しています

4

3 に答える 3

7

誰かが言ったように、ビルドスクリプトの実行中にビルド番号を出力でき、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 '<buildnum>']

于 2010-02-02T18:48:11.773 に答える
0

SVN リビジョン番号を TeamCity ビルド番号に含めることができます。Teamcity のビルド番号パターンでは、ビルド番号パターン フィールドで {build.vcs.number.1} のようなものを使用します。

その後、ビルド番号には実際の SVN リビジョン番号が含まれ、ラベリング パターン %system.build.number% にもそれが含まれます。

これがお役に立てば幸いです、KIR

于 2009-08-24T09:26:51.343 に答える
0

Ant を使用している場合は、SVNAnt.jar を入手してこれを試してください。

私が見たラベリングの規則は、major.minor.svn (および CI を使用している場合は .build) です。

于 2009-06-24T21:54:28.477 に答える