yavsc/Yavsc/Makefile

64 lines
1.6 KiB
Makefile

7 years ago
DESTDIR=/srv/www/yavscpre
PRODDESTDIR=/srv/www/yavsc
7 years ago
ASPNET_ENV=Development
CONFIGURATION=Release
7 years ago
ASPNET_LOG_LEVEL=info #warn
7 years ago
7 years ago
all: bin/$(CONFIGURATION)
7 years ago
git_status := $(shell git status -s --porcelain |wc -l)
status:
ifeq ($(git_status),0)
@echo Nothing to be done.
else
7 years ago
@echo There are pending changes:
@git status
endif
7 years ago
default: pushInPre
7 years ago
project.lock.json: project.json
dnu restore
watch: project.lock.json
ASPNET_ENV=$(ASPNET_ENV) ASPNET_LOG_LEVEL=$(ASPNET_LOG_LEVEL) dnx-watch web --configuration=$(CONFIGURATION)
7 years ago
run:
7 years ago
ASPNET_ENV=$(ASPNET_ENV) dnx web --configuration=$(CONFIGURATION)
7 years ago
clean:
7 years ago
rm -rf bin obj
cleanoutput:
7 years ago
rm -rf bin/$(CONFIGURATION)
rm -rf bin/output
7 years ago
7 years ago
bin/$(CONFIGURATION): project.lock.json
dnu build --configuration=$(CONFIGURATION)
7 years ago
7 years ago
bin/output: bin/$(CONFIGURATION)
7 years ago
@dnu publish
7 years ago
bin/output/wwwroot/version: bin/output
7 years ago
@git log -1 --pretty=format:%h > bin/output/wwwroot/version
7 years ago
7 years ago
pushInPre: cleanoutput 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
7 years ago
7 years ago
pushInProd: cleanoutput bin/output/wwwroot/version
ifeq ($(git_status),0)
7 years ago
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
7 years ago
else
@echo Err! Refus de pousser en production: des changements doivent être validés auprès du contrôle de versions.
7 years ago
git status
7 years ago
endif