-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (54 loc) · 1.58 KB
/
Copy pathMakefile
File metadata and controls
67 lines (54 loc) · 1.58 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
VERSION := $(shell cat VERSION)
# Default relay URL (can be overridden by .env.local or command line)
RELAY_URL ?= wss://aipilot-relay.softwarity.io
# Load .env.local if it exists (for local dev)
-include .env.local
LDFLAGS := -ldflags="-s -w -X main.Version=v$(VERSION) -X main.RelayURL=$(RELAY_URL)"
.PHONY: build run version patch minor major release clean
# Build binary
build:
go build $(LDFLAGS) -o aipilot-cli .
# Run locally
run:
go run $(LDFLAGS) .
# Clean build artifacts
clean:
rm -f aipilot-cli aipilot-cli-*
# Show current version
version:
@echo "v$(VERSION)"
# Bump patch version (0.0.X)
patch:
@V=$$(cat VERSION); \
MAJOR=$$(echo $$V | cut -d. -f1); \
MINOR=$$(echo $$V | cut -d. -f2); \
PATCH=$$(echo $$V | cut -d. -f3); \
NEW_PATCH=$$((PATCH + 1)); \
echo "$$MAJOR.$$MINOR.$$NEW_PATCH" > VERSION; \
echo "Bumped to v$$MAJOR.$$MINOR.$$NEW_PATCH"
# Bump minor version (0.X.0)
minor:
@V=$$(cat VERSION); \
MAJOR=$$(echo $$V | cut -d. -f1); \
MINOR=$$(echo $$V | cut -d. -f2); \
NEW_MINOR=$$((MINOR + 1)); \
echo "$$MAJOR.$$NEW_MINOR.0" > VERSION; \
echo "Bumped to v$$MAJOR.$$NEW_MINOR.0"
# Bump major version (X.0.0)
major:
@V=$$(cat VERSION); \
MAJOR=$$(echo $$V | cut -d. -f1); \
NEW_MAJOR=$$((MAJOR + 1)); \
echo "$$NEW_MAJOR.0.0" > VERSION; \
echo "Bumped to v$$NEW_MAJOR.0.0"
# Release: bump, commit, tag, push
release-patch: patch release
release-minor: minor release
release-major: major release
release:
@V=$$(cat VERSION); \
git add VERSION; \
git commit -m "Bump version to v$$V"; \
git tag "v$$V"; \
git push && git push --tags; \
echo "Released v$$V"