Skip to content

Commit

Permalink
some CI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bchavez committed Sep 22, 2015
1 parent 8095028 commit 55cc6ba
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 17 deletions.
6 changes: 3 additions & 3 deletions Source/Builder/BuildSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public class Folders

public class BuildContext
{
public static readonly string FullVersion = Environment.GetEnvironmentVariable("BUILD_VERSION").Trim() ?? "0.0.0.0";
public static readonly string Version = FullVersion.WithoutPreReleaseName();
public static readonly DateTime BuildDate = DateTime.UtcNow;
public static readonly string FullVersion = VersionGetter.GetVersion();
public static readonly string Version = FullVersion.WithoutPreReleaseName();
public static readonly DateTime BuildDate = DateTime.UtcNow;
}

public class Projects
Expand Down
4 changes: 4 additions & 0 deletions Source/Builder/Builder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Z.ExtensionMethods.WithTwoNamespace, Version=2.0.9.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Z.ExtensionMethods.WithTwoNamespace.2.0.9\lib\net45\Z.ExtensionMethods.WithTwoNamespace.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="BauBuild.cs" />
Expand Down
20 changes: 20 additions & 0 deletions Source/Builder/Utils/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using FluentBuild.ApplicationProperties;
using FluentFs.Core;
using Z.ExtensionMethods;

namespace Builder.Utils
{
Expand Down Expand Up @@ -34,4 +36,22 @@ public static string PreReleaseName(this string version)
return dash > 0 ? version.Substring(dash + 1) : null;
}
}


public static class VersionGetter
{
public static string GetVersion()
{
var ver = Environment.GetEnvironmentVariable("FORCE_VERSION")?.Trim();
if (ver.IsNotNullOrWhiteSpace())
return ver;
ver = Environment.GetEnvironmentVariable("APPVEYOR_REPO_TAG_NAME")?.Trim(' ', 'v');
if (ver.IsNotNullOrWhiteSpace())
return ver;
ver = Environment.GetEnvironmentVariable("APPVEYOR_BUILD_VERSION")?.Trim();
if( ver.IsNotNullOrWhiteSpace() )
return ver;
return "0.0.0-localbuild";
}
}
}
1 change: 1 addition & 0 deletions Source/Builder/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
<package id="NUnit" version="2.6.4" targetFramework="net46" />
<package id="NUnit.Runners" version="2.6.4" targetFramework="net46" />
<package id="ScriptCs.Contracts" version="0.9.0" targetFramework="net46" />
<package id="Z.ExtensionMethods.WithTwoNamespace" version="2.0.9" targetFramework="net46" />
</packages>
40 changes: 27 additions & 13 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
version: 0.0.{build}

build_script: build.cmd pack

test:
assemblies:
- __compile\Bogus.Tests.dll

artifacts:
- path: __package\*.nupkg

nuget:
disable_publish_on_pr: true
version: 3.0.0.{build}-alpha1

init:
-ps: |
If ($Env:APPVEYOR_REPO_TAG_NAME -match "-")
Set-AppveyorBuildVariable -Name "IsPreRelease" -Value True
Else
Set-AppveyorBuildVariable -Name "IsPreRelease" -Value False
build_script: build.cmd pack

test:
assemblies:
- __compile\Bogus.Tests.dll

artifacts:
- path: __package\*.nupkg
name: NuGet

deploy:
- provider: NuGet
api_key:
secure: 1nPS2ttf+N4+FUhd+GZycrL7YzSWQpZjnGOMCb5+pGJXSdx0IFvVF8xhTGna7B9t
artifact: NuGet
on:
branch: /v\d+\.\d+\.\d+/
appveyor_repo_tag: true
4 changes: 3 additions & 1 deletion build.cmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
@ECHO OFF
SETLOCAL

set BUILD_VERSION=3.0.1.4
REM Uncomment to forcibly set the build version.
REM set FORCE_VERSION=3.1.0.4


IF NOT DEFINED DevEnvDir (
IF DEFINED vs140comntools (
Expand Down

0 comments on commit 55cc6ba

Please sign in to comment.