Deploy hooks
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
COMPOSE := docker compose{% if layout == 'part' %} --project-directory ..{% endif %}
|
||||
{% if serve != 'api' %}IMAGE := {{ project_slug }}/frontend
|
||||
{% endif %}changed = ! git diff --quiet $(1) -- $(2) 2>/dev/null
|
||||
stamp = { git update-ref $(1) HEAD 2>/dev/null || true; }
|
||||
|
||||
.PHONY: {% if layout == 'root' %}env recreate rebuild restart logs down {% endif %}fmt check build dev
|
||||
.PHONY: {% if layout == 'root' %}env recreate rebuild restart logs down deploy {% endif %}fmt check build pre-deploy post-deploy dev
|
||||
|
||||
fmt:
|
||||
bun run fix
|
||||
@@ -13,6 +16,14 @@ build:
|
||||
{% if serve == 'api' %} $(COMPOSE) run --rm frontend-dev sh -c "bun install && bun run build"
|
||||
{% else %} $(COMPOSE) build frontend
|
||||
{% endif %}
|
||||
pre-deploy:
|
||||
@if $(call changed,refs/deploy/frontend,.) || {% if serve == 'api' %}! test -d build{% else %}! docker image inspect $(IMAGE) >/dev/null 2>&1{% endif %}; then \
|
||||
$(MAKE) build && $(call stamp,refs/deploy/frontend); \
|
||||
fi
|
||||
|
||||
post-deploy:
|
||||
@:
|
||||
|
||||
dev:
|
||||
bun run dev
|
||||
{% if layout == 'root' %}
|
||||
@@ -34,4 +45,8 @@ logs:
|
||||
|
||||
down:
|
||||
$(COMPOSE) down
|
||||
|
||||
deploy: pre-deploy
|
||||
$(COMPOSE) up -d
|
||||
$(MAKE) post-deploy
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user