yavsc/Yavsc/Makefile

62 lines
1.6 KiB
Makefile
Raw Normal View History

2017-06-02 02:27:48 +02:00
DESTDIR=/srv/www/yavscpre
PRODDESTDIR=/srv/www/yavsc
2017-06-08 17:09:06 +02:00
ASPNET_ENV=Development
2017-06-27 04:40:23 +02:00
CONFIGURATION=Debug
2017-06-02 02:27:48 +02:00
2017-06-27 04:40:23 +02:00
all: bin/$(CONFIGURATION)
2017-06-27 03:46:43 +02:00
2017-06-08 12:04:37 +02:00
git_status := $(shell git status -s --porcelain |wc -l)
status:
ifeq ($(git_status),0)
@echo Nothing to be done.
else
2017-06-27 04:40:23 +02:00
@echo There are pending changes:
2017-06-08 12:04:37 +02:00
@git status
endif
2017-06-02 02:27:48 +02:00
default: pushInPre
2017-06-27 03:46:43 +02:00
project.lock.json: project.json
dnu restore
watch: project.lock.json
2017-06-27 04:40:23 +02:00
ASPNET_ENV=$(ASPNET_ENV) dnx-watch web --configuration=$(CONFIGURATION)
2017-06-08 17:09:06 +02:00
run:
2017-06-27 04:40:23 +02:00
ASPNET_ENV=$(ASPNET_ENV) dnx web --configuration=$(CONFIGURATION)
2017-06-03 01:04:10 +02:00
2017-06-08 00:26:29 +02:00
clean:
2017-06-27 03:46:43 +02:00
rm -rf bin obj
cleanoutput:
2017-06-27 04:40:23 +02:00
rm -rf bin/$(CONFIGURATION)
rm -rf bin/output
2017-06-02 02:27:48 +02:00
2017-06-27 04:40:23 +02:00
bin/$(CONFIGURATION): project.lock.json
dnu build --configuration=$(CONFIGURATION)
2017-06-02 02:27:48 +02:00
2017-06-27 04:40:23 +02:00
bin/output: bin/$(CONFIGURATION)
2017-06-08 17:09:06 +02:00
@dnu publish
2017-06-02 02:27:48 +02:00
bin/output/wwwroot/version: bin/output
2017-06-08 17:09:06 +02:00
@git log -1 --pretty=format:%h > bin/output/wwwroot/version
2017-06-02 02:27:48 +02:00
2017-06-27 03:46:43 +02:00
pushInPre: cleanoutput bin/output/wwwroot/version
2017-06-08 17:16:34 +02:00
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
2017-06-02 02:27:48 +02:00
2017-06-27 03:46:43 +02:00
pushInProd: cleanoutput bin/output/wwwroot/version
2017-06-08 12:04:37 +02:00
ifeq ($(git_status),0)
2017-06-09 00:46:06 +02:00
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
2017-06-08 11:43:30 +02:00
else
2017-06-08 12:04:37 +02:00
@echo Err! Refus de pousser en production: des changements doivent être validés auprès du contrôle de versions.
2017-06-09 00:46:06 +02:00
git status
2017-06-08 11:43:30 +02:00
endif