variables: NUGET_PATH: 'C:\Tools\nuget.exe' MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe' #hasSource: '& "$env:NUGET_PATH" sources list | find "`"Steamware Nexus`"" /C' #hasSource: '0' stages: - build - deploy #build_job: # stage: build # script: # - |- # echo $env:hasSource # if ($env:hasSource -eq 0) # { # $env:NUGET_PATH sources Add -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" #-password "`"viaDante16`"" # } # else # { # - '& "$env:NUGET_PATH" sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""' # } # $env:NUGET_PATH restore # #- '& "$env:NUGET_PATH" restore LPA.sln' # $env:MSBUILD_PATH LPA/LPA.csproj /p:DeployOnBuild=true /p:Configuration=Release /p:OutputPath=bin/ build_job: stage: build script: - | $hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C if ($hasSource -eq 0) { C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`"" } else { C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`"" } echo $hasSource - '& "$env:NUGET_PATH" restore' - '& "$env:MSBUILD_PATH" LPA/LPA.csproj /p:DeployOnBuild=true /p:Configuration=Release /p:OutputPath=sourcecode/' #artifacts: # expire_in: 365 days #artifcats will be stored only 365 days after this it will # paths: # - '.\sourcecode\project.sln\bin\Release\Publish\' # - '.\sourcecode\project.sln\bin\Publish\' deploy_job: stage: deploy script: - 'xcopy /y /s ".\sourcecode\*.*" "C:\solutionDir"' #Path where you want to store the solution