-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (45 loc) · 1.67 KB
/
Copy pathMakefile
File metadata and controls
60 lines (45 loc) · 1.67 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
.PHONY: cli-build cli-test cli-clean claude-message-build claude-message-test claude-message-clean npm-auth-check publish unpublish release publish-agent-message publish-codex-message publish-claude-message
CLI_DIR := cli
CLI_BINARY := agent-message
CODEX_MESSAGE_DIR := codex-message
CLAUDE_MESSAGE_DIR := claude-message
CLAUDE_MESSAGE_BINARY := claude-message
PUBLISH_RETRIES ?= 5
NPM_PUBLISH_AUTH_ENV := npm_config_auth_type=legacy
define npm_publish_with_retries
attempt=1; \
while [ $$attempt -le $(PUBLISH_RETRIES) ]; do \
$(NPM_PUBLISH_AUTH_ENV) npm publish && exit 0; \
if [ $$attempt -eq $(PUBLISH_RETRIES) ]; then \
exit 1; \
fi; \
echo "npm publish failed, retrying ($$attempt/$(PUBLISH_RETRIES))..." >&2; \
attempt=$$((attempt + 1)); \
sleep 5; \
done
endef
cli-build:
cd $(CLI_DIR) && go build -o ../$(CLI_BINARY) .
cli-test:
cd $(CLI_DIR) && go test ./...
cli-clean:
rm -f ./$(CLI_BINARY)
claude-message-build:
cargo build --manifest-path $(CLAUDE_MESSAGE_DIR)/Cargo.toml
claude-message-test:
cargo test --manifest-path $(CLAUDE_MESSAGE_DIR)/Cargo.toml
claude-message-clean:
rm -rf $(CLAUDE_MESSAGE_DIR)/target
npm-auth-check:
$(NPM_PUBLISH_AUTH_ENV) npm whoami >/dev/null
publish:
docker compose --env-file .env.selfhost -f docker-compose.selfhost.yml up -d --build
unpublish:
docker compose --env-file .env.selfhost -f docker-compose.selfhost.yml down
release: npm-auth-check publish-agent-message publish-codex-message publish-claude-message
publish-agent-message:
$(npm_publish_with_retries)
publish-codex-message:
cd $(CODEX_MESSAGE_DIR) && $(npm_publish_with_retries)
publish-claude-message:
cd $(CLAUDE_MESSAGE_DIR) && $(npm_publish_with_retries)