Skip to content

Instantly share code, notes, and snippets.

@XEngine
Created May 13, 2019 15:04
Show Gist options
  • Save XEngine/d0792b61e34b682d570462143076c3fe to your computer and use it in GitHub Desktop.
Save XEngine/d0792b61e34b682d570462143076c3fe to your computer and use it in GitHub Desktop.
.backup: &backup |
& robocopy "$target" "$target-$datetime" /MIR
.publish: &publish |
$array = @("assets", "Views", "bin", "config")
foreach ($element in $array) {
robocopy "./publish/$element" "$target/$element" /E /MIR /IS /IT
}
variables:
EXE_RELEASE_FOLDER: ''
DEPLOY_FOLDER: 'C:\htdocs\www.test.de'
NUGET_PATH: 'C:\Runner\nuget.exe'
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe'
stages:
- build
- backup
- publish
build:
stage: build
only:
- tags
before_script:
- 'cd .\Store\'
- 'npm i'
- 'cd ..'
script:
- '& "$env:NUGET_PATH" restore' # restore Nuget dependencies
- '& "$env:MSBUILD_PATH" Core.sln /p:PublishProfile=just4menpublishprofile.pubxml /p:Configuration=Release /p:DeployOnBuild=true' # build the project
backup:
stage: backup
only:
- tags
script:
- ' $target=Join-Path -Path "C:\htdocs\" -ChildPath (Get-ChildItem "C:\htdocs" -Directory | ?{ $_.Name -match "www.*.de" } | select -First 1)'
- ' $datetime=Get-Date -UFormat %d-%m-%Y--%H-%M'
- *backup
publish:
stage: build
only:
- tags
before_script:
- 'cd .\Store\'
- 'npm i --silent'
- 'cd ..'
script:
- '& "$env:NUGET_PATH" restore -verbosity "quiet"' # restore Nuget dependencies
- '& "$env:MSBUILD_PATH" Core.sln /p:PublishProfile=just4menpublishprofile.pubxml /p:Configuration=Release /p:DeployOnBuild=true /verbosity:minimal' # build the project
- '$target=Join-Path -Path "C:\htdocs\" -ChildPath (Get-ChildItem "C:\htdocs" -Directory | ?{ $_.Name -match "www.*.de" } | select -First 1)' #target folder
- *publish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment