This commit is contained in:
2017-06-08 17:09:06 +02:00
parent a5286af1e5
commit e95de6a9c3
18 changed files with 193 additions and 114 deletions

View File

@ -1,5 +1,6 @@
DESTDIR=/srv/www/yavscpre
PRODDESTDIR=/srv/www/yavsc
ASPNET_ENV=Development
git_status := $(shell git status -s --porcelain |wc -l)
@ -13,35 +14,38 @@ endif
default: pushInPre
watch:
ASPNET_ENV=Development dnx-watch web --configuration=Debug
@ASPNET_ENV=$(ASPNET_ENV) dnx-watch web --configuration=Debug
run:
@ASPNET_ENV=$(ASPNET_ENV) dnx web --configuration=Debug
clean:
rm -rf bin/Release
rm -rf bin/output
@rm -rf bin/Release
@rm -rf bin/output
bin/Release:
dnu build --configuration=Release
@dnu build --configuration=Release
bin/output: bin/Release
dnu publish
@dnu publish
bin/output/wwwroot/version: bin/output
git log -1 --pretty=format:%h > bin/output/wwwroot/version
@git log -1 --pretty=format:%h > bin/output/wwwroot/version
pushInPre: bin/output/wwwroot/version
ssh root@localhost systemctl stop kestrel-pre
ssh root@localhost rm -rf $(DESTDIR)/approot
(cd bin/output && rsync -ravu ./ root@localhost:$(DESTDIR) >/dev/null)
ssh root@localhost sync
ssh root@localhost systemctl start kestrel-pre
@ssh root@localhost systemctl stop kestrel-pre
@ssh root@localhost rm -rf $(DESTDIR)/approot
@(cd bin/output && rsync -ravu ./ root@localhost:$(DESTDIR) >/dev/null)
@ssh root@localhost sync
@ssh root@localhost systemctl start kestrel-pre
pushInProd: bin/output/wwwroot/version
ifeq ($(git_status),0)
ssh root@localhost systemctl stop kestrel
ssh root@localhost rm -rf $(PRODDESTDIR)/approot
(cd bin/output && rsync -ravu ./ root@localhost:$(PRODDESTDIR) >/dev/null)
ssh root@localhost sync
ssh root@localhost systemctl start kestrel
@ssh root@localhost systemctl stop kestrel
@ssh root@localhost rm -rf $(PRODDESTDIR)/approot
@(cd bin/output && rsync -ravu ./ root@localhost:$(PRODDESTDIR) >/dev/null)
@ssh root@localhost sync
@ssh root@localhost systemctl start kestrel
else
@echo Err! Refus de pousser en production: des changements doivent être validés auprès du contrôle de versions.
@git status