-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (38 loc) Β· 1.8 KB
/
Copy pathMakefile
File metadata and controls
47 lines (38 loc) Β· 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
PLUGIN_NAME := gotify-commander
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
VPS_HOST ?= your-server
VPS_USER ?= your-user
VPS_REPO ?= /path/to/gotify-commander
VPS_PLUGIN_DIR ?= /path/to/gotify/data/plugins
GOTIFY_SERVICE := gotify
GOTIFY_BUILD_IMAGE := gotify/build:1.26.0-linux-amd64
DOCKER_GO_BUILD := go build -mod=readonly -a -installsuffix cgo -buildmode=plugin
.PHONY: test lint build deploy deploy-dev clean help
test:
go test ./... -v -count=1
lint:
go vet ./...
build: test lint
@echo "β
Tests and lint passed (plugin .so must be built via Docker on Linux)"
deploy:
@echo "π Deploying to VPS..."
ssh $(VPS_USER)@$(VPS_HOST) 'cd $(VPS_REPO) && git pull && sudo docker run --rm -v "$$PWD:/proj" -w /proj $(GOTIFY_BUILD_IMAGE) $(DOCKER_GO_BUILD) -o $(PLUGIN_NAME).so . && cp $(PLUGIN_NAME).so $(VPS_PLUGIN_DIR)/ && sudo systemctl restart $(GOTIFY_SERVICE)'
@echo "β
Deployed and Gotify restarted"
deploy-dev:
@echo "π Fast deploy (skip tests)..."
ssh $(VPS_USER)@$(VPS_HOST) 'cd $(VPS_REPO) && git pull && sudo docker run --rm -v "$$PWD:/proj" -w /proj $(GOTIFY_BUILD_IMAGE) $(DOCKER_GO_BUILD) -o $(PLUGIN_NAME).so . && cp $(PLUGIN_NAME).so $(VPS_PLUGIN_DIR)/ && sudo systemctl restart $(GOTIFY_SERVICE)'
@echo "β
Deployed"
clean:
rm -rf build/ *.so
help:
@echo ""
@echo " gotify-commander β Build & Deploy"
@echo " ββββββββββββββββββββββββββββββββββ"
@echo ""
@echo " make test Run unit tests"
@echo " make lint Run go vet"
@echo " make build Test + lint (validation)"
@echo " make deploy SSH β build on VPS β install β restart Gotify"
@echo " make deploy-dev Fast deploy, skip tests"
@echo " make clean Remove build artifacts"
@echo ""