From 1ad7d8e6378a03a56abd165e7383c48d85867d4c Mon Sep 17 00:00:00 2001 From: Julian Verdurmen <304NotModified@users.noreply.github.com> Date: Sun, 28 Feb 2021 22:43:51 +0100 Subject: [PATCH] Move to build.ps1 --- appveyor.yml | 20 +------------------- build.ps1 | 28 ++++++++++++++++++++++++++++ build_aspnet.bat | 34 ---------------------------------- 3 files changed, 29 insertions(+), 53 deletions(-) create mode 100644 build.ps1 delete mode 100644 build_aspnet.bat diff --git a/appveyor.yml b/appveyor.yml index 3d209d19..706c0142 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,25 +16,7 @@ build: skip_tags: true build_script: -- ps: | - $versionPrefix = "4.11.0" - $versionSuffix = "" - $versionBuild = $versionPrefix + "." + ${env:APPVEYOR_BUILD_NUMBER} - $versionNuget = $versionPrefix - if ($env:APPVEYOR_PULL_REQUEST_NUMBER) - { - $versionPrefix = $versionBuild - $versionSuffix = "PR" + $env:APPVEYOR_PULL_REQUEST_NUMBER - } - if ($versionSuffix) - { - $versionNuget = $versionPrefix + "-" + $versionSuffix - } - $build_aspnet = "build_aspnet.bat", "-version_prefix=$versionPrefix", "-version_build=$versionBuild", "-version_suffix=$versionSuffix" - & cmd /c $build_aspnet - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } + - ps: .\build.ps1 deploy: - provider: NuGet diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 00000000..a2a0b210 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,28 @@ +# restore and builds all projects as release. +# creates NuGet package at \artifacts +dotnet --version + +$versionPrefix = "4.11.0" # Also update version for minor versions in appveyor.yml +$versionSuffix = "" +$versionFile = $versionPrefix + "." + ${env:APPVEYOR_BUILD_NUMBER} +if ($env:APPVEYOR_PULL_REQUEST_NUMBER) { + $versionPrefix = $versionFile + $versionSuffix = "PR" + $env:APPVEYOR_PULL_REQUEST_NUMBER +} + +msbuild NLog.Web.sln /t:restore,rebuild /p:configuration=release /p:ContinuousIntegrationBuild=true /verbosity:minimal +if (-Not $LastExitCode -eq 0) { + exit $LastExitCode +} + +msbuild src\NLog.Web /t:rebuild,pack /p:configuration=release /verbosity:minimal /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:ContinuousIntegrationBuild=true /p:VersionPrefix=$versionPrefix /p:VersionSuffix=$versionSuffix /p:FileVersion=$versionFile +if (-Not $LastExitCode -eq 0) { + exit $LastExitCode +} + +msbuild src\NLog.Web.AspNetCore /t:rebuild,pack /p:configuration=release /verbosity:minimal /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:ContinuousIntegrationBuild=true /p:VersionPrefix=$versionPrefix /p:VersionSuffix=$versionSuffix /p:FileVersion=$versionFile +if (-Not $LastExitCode -eq 0) { + exit $LastExitCode +} + +exit $LastExitCode diff --git a/build_aspnet.bat b/build_aspnet.bat deleted file mode 100644 index 2f6b89e7..00000000 --- a/build_aspnet.bat +++ /dev/null @@ -1,34 +0,0 @@ -@echo off - -rem fallback if not passed -set version_prefix=1.0.0 -set version_suffix= -set version_build=%version_prefix% - -call :read_params %* - -msbuild NLog.Web.sln /t:restore,rebuild /p:configuration=release /p:ContinuousIntegrationBuild=true /verbosity:minimal -IF ERRORLEVEL 1 EXIT /B 1 - -msbuild src\NLog.Web /t:rebuild,pack /p:configuration=release /verbosity:minimal /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:ContinuousIntegrationBuild=true /p:VersionPrefix=%version_prefix% /p:FileVersion=%version_build% /p:VersionSuffix=%version_suffix% -IF ERRORLEVEL 1 EXIT /B 1 - -msbuild src\NLog.Web.AspNetCore /t:rebuild,pack /p:configuration=release /verbosity:minimal /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:ContinuousIntegrationBuild=true /p:VersionPrefix=%version_prefix% /p:FileVersion=%version_build% /p:VersionSuffix=%version_suffix% -IF ERRORLEVEL 1 EXIT /B 1 - -rem read pass parameters by name -:read_params -if not %1/==/ ( - if not "%__var%"=="" ( - if not "%__var:~0,1%"=="-" ( - endlocal - goto read_params - ) - endlocal & set %__var:~1%=%~1 - ) else ( - setlocal & set __var=%~1 - ) - shift - goto read_params -) -exit /B