diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 000000000..aade6b109 --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1 @@ +next-version: 3.0.0 \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 683e76871..f6a14f1b0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,12 +1,6 @@ version: 3.0.{build} configuration: Release os: Visual Studio 2015 -dotnet_csproj: - patch: true - file: '**\*.csproj' - version: '{version}-$(APPVEYOR_REPO_BRANCH)' - package_version: '{version}' - environment: nodejs_version: "7.8.0" @@ -35,6 +29,8 @@ after_build: +#cache: +#- '%USERPROFILE%\.nuget\packages' deploy: - provider: GitHub release: Ombi v$(appveyor_build_version) diff --git a/build.cake b/build.cake index 474f13905..92323655c 100644 --- a/build.cake +++ b/build.cake @@ -1,14 +1,16 @@ #tool "xunit.runner.console" +#tool "nuget:?package=GitVersion.CommandLine" #addin "Cake.Gulp" #addin "Cake.Npm" #addin "SharpZipLib" #addin "Cake.Compression" +#addin "Cake.Incubator" ////////////////////////////////////////////////////////////////////// // ARGUMENTS ////////////////////////////////////////////////////////////////////// -var target = Argument("target", "Default"); +var target = Argument("target", "Build"); var configuration = Argument("configuration", "Release"); ////////////////////////////////////////////////////////////////////// @@ -22,13 +24,13 @@ var projDir = "./src/"; // Project Directory var webProjDir = "./src/Ombi"; var csProj = "./src/Ombi/Ombi.csproj"; // Path to the project.csproj var solutionFile = "Ombi.sln"; // Solution file if needed +GitVersion versionInfo = null; var buildSettings = new DotNetCoreBuildSettings { Framework = "netcoreapp1.1", Configuration = "Release", OutputDirectory = Directory(buildDir), - VersionSuffix = GetVersion(), }; var publishSettings = new DotNetCorePublishSettings @@ -36,7 +38,6 @@ var publishSettings = new DotNetCorePublishSettings Framework = "netcoreapp1.1", Configuration = "Release", OutputDirectory = Directory(buildDir), - VersionSuffix = GetVersion(), }; var artifactsFolder = buildDir + "/netcoreapp1.1/"; @@ -47,19 +48,7 @@ var debianArtifactsFolder = artifactsFolder + "debian.8-x64/published"; var centosArtifactsFolder = artifactsFolder + "centos.7-x64/published"; -////////////////////////////////////////////////////////////////////// -// Helper -////////////////////////////////////////////////////////////////////// -public string GetVersion() -{ - if (AppVeyor.IsRunningOnAppVeyor) { - // Update the version - return AppVeyor.Environment.Build.Version; - //AppVeyor.Environment.Repository.Branch; - } - return "3.0.100"; -} ////////////////////////////////////////////////////////////////////// // TASKS @@ -69,13 +58,35 @@ Task("Clean") .Does(() => { CleanDirectory(buildDir); - CleanDirectory(nodeModulesDir); + //CleanDirectory(nodeModulesDir); CleanDirectory(wwwRootDistDir); }); -Task("Restore") +Task("SetVersionInfo") .IsDependentOn("Clean") - .IsDependentOn("Gulp Publish") + .Does(() => +{ + var settings = new GitVersionSettings { + RepositoryPath = ".", + }; + + if (AppVeyor.IsRunningOnAppVeyor) { + settings.Branch = AppVeyor.Environment.Repository.Branch; + } else { + settings.Branch = "master"; + } + + versionInfo = GitVersion(settings); + + Information("GitResults -> {0}", versionInfo.Dump()); + + buildSettings.ArgumentCustomization = args => args.Append("/p:SemVer=" + versionInfo.BuildMetaData); + publishSettings.ArgumentCustomization = args => args.Append("/p:SemVer=" + versionInfo.BuildMetaData); +}); + +Task("Restore") + .IsDependentOn("SetVersionInfo") + //.IsDependentOn("Gulp Publish") .Does(() => { DotNetCoreRestore(projDir); @@ -123,9 +134,9 @@ Task("Package") Task("Publish") .IsDependentOn("Build") - .IsDependentOn("Publish-Windows") - .IsDependentOn("Publish-OSX").IsDependentOn("Publish-Ubuntu").IsDependentOn("Publish-Debian").IsDependentOn("Publish-Centos") - .IsDependentOn("Package"); + .IsDependentOn("Publish-Windows"); + //.IsDependentOn("Publish-OSX").IsDependentOn("Publish-Ubuntu").IsDependentOn("Publish-Debian").IsDependentOn("Publish-Centos") + //.IsDependentOn("Package"); Task("Publish-Windows") .Does(() => diff --git a/src/Ombi/Ombi.csproj b/src/Ombi/Ombi.csproj index 6ac9e5f0b..2772d2f69 100644 --- a/src/Ombi/Ombi.csproj +++ b/src/Ombi/Ombi.csproj @@ -5,9 +5,9 @@ win10-x64;osx.10.12-x64;ubuntu.16.04-x64;debian.8-x64;centos.7-x64; false 2.3 - 3.0.0.0 - 3.0.0.0 - + $(SemVer) + $(SemVer) + $(SemVer)