Skip to content

Commit e81c4ec

Browse files
TravisCI build server integration
1 parent 31ec96f commit e81c4ec

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

src/GitVersionCore/BuildServers/BuildServerList.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ public static class BuildServerList
1313
new MyGet(),
1414
new Jenkins(),
1515
new GitLabCi(),
16-
new VsoAgent()
16+
new VsoAgent(),
17+
new TravisCI(),
1718
};
1819

1920
public static IEnumerable<IBuildServer> GetApplicableBuildServers()
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
namespace GitVersion
3+
{
4+
public class TravisCI : BuildServerBase
5+
{
6+
public override bool CanApplyToCurrentContext ()
7+
{
8+
return "true".Equals(Environment.GetEnvironmentVariable ("TRAVIS")) && "true".Equals(Environment.GetEnvironmentVariable("CI"));
9+
}
10+
11+
public override string GenerateSetVersionMessage(VersionVariables variables)
12+
{
13+
return variables.FullSemVer;
14+
}
15+
16+
public override string[] GenerateSetParameterMessage(string name, string value)
17+
{
18+
return new[]
19+
{
20+
string.Format("GitVersion_{0}={1}", name, value)
21+
};
22+
}
23+
24+
public override bool PreventFetch ()
25+
{
26+
return true;
27+
}
28+
}
29+
}
30+

src/GitVersionCore/GitVersionCore.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
<Compile Include="SemanticVersion.cs" />
166166
<Compile Include="SemanticVersionBuildMetaData.cs" />
167167
<Compile Include="SemanticVersionPreReleaseTag.cs" />
168+
<Compile Include="BuildServers\TravisCI.cs" />
168169
</ItemGroup>
169170
<ItemGroup>
170171
<Content Include="FodyWeavers.xml">

0 commit comments

Comments
 (0)