yavsc/Yavsc/Makefile

67 lines
1.8 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
CONFIGURATION=Release
2017-07-15 03:49:06 +02:00
ASPNET_LOG_LEVEL=info #warn
2017-10-20 16:29:22 +02:00
HOSTING=localhost
HOSTADMIN=root
2017-06-02 02:27:48 +02:00
2017-09-20 13:05:10 +02:00
deploy: clean pushInPre pushInProd
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-07-03 15:54:18 +02:00
ASPNET_ENV=$(ASPNET_ENV) ASPNET_LOG_LEVEL=$(ASPNET_LOG_LEVEL) 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-10-20 19:31:36 +02:00
ssh $(HOSTADMIN)@$(HOSTING) sudo service kestrel-pre stop
ssh $(HOSTADMIN)@$(HOSTING) sudo rm -rf $(DESTDIR)/approot
2017-10-20 16:29:22 +02:00
(cd bin/output && rsync -ravu ./ $(HOSTADMIN)@$(HOSTING):$(DESTDIR) >/dev/null)
2017-10-20 19:31:36 +02:00
ssh $(HOSTADMIN)@$(HOSTING) sudo sync
ssh $(HOSTADMIN)@$(HOSTING) sudo service kestrel-pre start
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-10-20 19:31:36 +02:00
ssh $(HOSTADMIN)@$(HOSTING) sudo service kestrel stop
ssh $(HOSTADMIN)@$(HOSTING) sudo rm -rf $(PRODDESTDIR)/approot
2017-10-20 16:29:22 +02:00
(cd bin/output && rsync -ravu ./ $(HOSTADMIN)@$(HOSTING):$(PRODDESTDIR) >/dev/null)
2017-10-20 19:31:36 +02:00
ssh $(HOSTADMIN)@$(HOSTING) sudo sync
ssh $(HOSTADMIN)@$(HOSTING) sudo service kestrel start
2017-06-08 11:43:30 +02:00
else
2017-10-20 16:29:22 +02:00
@echo EPRODANDGITSTATUS! 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