-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
108 lines (90 loc) · 4.34 KB
/
Copy pathMakefile
File metadata and controls
108 lines (90 loc) · 4.34 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
APP := Pluk
BUNDLE_ID := com.pluk.app
DIST := dist
.PHONY: dev deps server swift-build bundle install zip release publish publish-minor publish-major clean
# ── Dev ───────────────────────────────────────────────────────────────────────
dev:
cd swift && swift run
# ── Build ─────────────────────────────────────────────────────────────────────
deps:
@printf "→ installing pluk deps\n"
cd pluk && bun install
server: deps
@printf "→ compiling server binary\n"
@mkdir -p $(DIST)
@# cpu-features ships a native .node addon bun can't bundle; mark it external so it's
@# left out of the binary. ssh2 wraps the require in try/catch, so the runtime require
@# fails gracefully without it — no node_modules mutation needed.
cd pluk && bun build --compile --external cpu-features src/server.ts --outfile ../$(DIST)/pluk-server
@chmod +x $(DIST)/pluk-server
@codesign --force --sign - $(DIST)/pluk-server
swift-build:
@printf "→ building Swift app\n"
cd swift && swift build -c release
bundle: server swift-build
@v=$$(cat VERSION); \
commit=$$(git rev-parse HEAD); \
printf "→ assembling Pluk.app v$$v ($$commit)\n"; \
rm -rf $(DIST)/$(APP).app; \
mkdir -p $(DIST)/$(APP).app/Contents/MacOS; \
mkdir -p $(DIST)/$(APP).app/Contents/Resources; \
cp swift/.build/release/$(APP) $(DIST)/$(APP).app/Contents/MacOS/; \
cp $(DIST)/pluk-server $(DIST)/$(APP).app/Contents/Resources/pluk-server; \
chmod +x $(DIST)/$(APP).app/Contents/Resources/pluk-server; \
cp swift/AppIcon.icns $(DIST)/$(APP).app/Contents/Resources/AppIcon.icns; \
cp swift/Sources/Resources/MenuBarIcon.png $(DIST)/$(APP).app/Contents/Resources/MenuBarIcon.png; \
cp -R swift/Sources/Resources/AdapterLogos $(DIST)/$(APP).app/Contents/Resources/AdapterLogos; \
sed -e "s/{{VERSION}}/$$v/g" \
-e "s/{{COMMIT}}/$$commit/g" \
-e "s|{{REPO}}|$(CURDIR)|g" \
swift/Info.plist.template \
> $(DIST)/$(APP).app/Contents/Info.plist
ifdef APPLE_IDENTITY
@printf "→ signing with $(APPLE_IDENTITY)\n"
codesign --deep --force --verify --sign "$(APPLE_IDENTITY)" $(DIST)/$(APP).app
endif
# ── Install ───────────────────────────────────────────────────────────────────
install: bundle
@printf "→ installing $(APP).app to /Applications\n"
@osascript -e 'tell application "$(APP)" to quit' >/dev/null 2>&1 || true
@rm -rf "/Applications/$(APP).app"
@cp -R "$(DIST)/$(APP).app" "/Applications/$(APP).app"
@printf "→ installed /Applications/$(APP).app — launching\n"
@open "/Applications/$(APP).app"
zip: bundle
@v=$$(cat VERSION); \
cd $(DIST) && zip -qr $(APP)-$$v.zip $(APP).app; \
printf "→ $(DIST)/$(APP)-$$v.zip ready\n"
release: zip
@v=$$(cat VERSION); \
printf "→ releasing v$$v\n"; \
git add VERSION; \
git commit -m "chore: release v$$v"; \
git tag -a "v$$v" -m "v$$v"; \
git push origin HEAD "v$$v"; \
gh release create "v$$v" "$(DIST)/$(APP)-$$v.zip" \
--title "Pluk v$$v" \
--generate-notes
# ── Publish (bump + release) ──────────────────────────────────────────────────
publish:
@old=$$(cat VERSION); \
IFS=. read -r maj min pat <<< "$$old"; \
echo "$$maj.$$min.$$((pat+1))" > VERSION; \
printf "→ $$old → $$(cat VERSION)\n"
@$(MAKE) --no-print-directory release
publish-minor:
@old=$$(cat VERSION); \
IFS=. read -r maj min pat <<< "$$old"; \
echo "$$maj.$$((min+1)).0" > VERSION; \
printf "→ $$old → $$(cat VERSION)\n"
@$(MAKE) --no-print-directory release
publish-major:
@old=$$(cat VERSION); \
IFS=. read -r maj min pat <<< "$$old"; \
echo "$$((maj+1)).0.0" > VERSION; \
printf "→ $$old → $$(cat VERSION)\n"
@$(MAKE) --no-print-directory release
# ── Clean ─────────────────────────────────────────────────────────────────────
clean:
rm -rf $(DIST)
cd swift && swift package clean