-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (56 loc) · 3.27 KB
/
Copy pathMakefile
File metadata and controls
65 lines (56 loc) · 3.27 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
# Makefile for @byted-supabase/cli
#
# Publish to public npmjs (version comes from the git tag, never typed by hand):
# git tag v0.1.3 && git push origin v0.1.3 # the tag is the single source of truth
# make npm-release # build all platforms + publish 7 packages
#
# Distribution model: the npm package ships NO binary itself. The native binary
# lives in one of six per-platform optional dependencies
# (@byted-supabase/cli-<os>-<arch>); npm installs only the one matching the host,
# so there is no install-time CDN download. scripts/release.mjs orchestrates the
# whole release (safety rails: master-only, clean tree, tag-derived version, and
# never overwriting an already-published version) and publishes the six platform
# packages first, the main package last. CGO is disabled, so one build host
# cross-compiles every target — no goreleaser, no per-OS runners.
#
# Run `make npm-release-dry` first to rehearse (builds + `npm publish --dry-run`,
# no upload). Auth: set NODE_AUTH_TOKEN (npm Automation token) or `npm login`.
# Full git describe, with the leading "v" stripped. On a tagged commit this is
# the clean version (v0.1.3 -> 0.1.3); between tags it carries the distance and
# commit (0.1.3-8-gc45ca44), so a local dev build is distinguishable from the
# published release at a glance. Used only by build-cli; the release script
# reads the tag itself.
VERSION ?= $(shell git describe --tags 2>/dev/null | sed 's/^v//')
DIST ?= dist
BINARY ?= byted-supabase-cli
.DEFAULT_GOAL := help
.PHONY: help npm-release npm-release-dry build-cli e2e-live
# Self-documenting help: lists every target with a `## comment` on its rule line.
help:
@echo "Usage: make <target>"
@echo
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "} {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'
# Build the CLI for the host platform into $(DIST)/. Version is injected the same
# way goreleaser stamps it (-X internal/utils.Version), so `byted-supabase-cli
# --version` reports the git tag instead of an empty string.
build-cli: ## Build the CLI into ./dist for the host platform
CGO_ENABLED=0 go build -trimpath \
-ldflags "-s -w -X github.com/volcengine/byted-supabase-cli/internal/utils.Version=$(VERSION)" \
-o $(DIST)/$(BINARY) main.go
@echo "built $(DIST)/$(BINARY) (version: $(if $(VERSION),$(VERSION),dev))"
# Live e2e: drives $(DIST)/$(BINARY) against a real Volcengine account —
# creates and deletes a workspace, so it bills the account. Auth and knobs are
# documented in test/e2e/README.md. Kept out of `go test ./...` by the
# live_e2e build tag.
e2e-live: build-cli ## Run live e2e tests against a real Volcengine account (creates a workspace)
go test -tags live_e2e -v -timeout 45m -count=1 ./test/e2e/...
# Cross-compile every platform and publish all 7 packages. All safety rails live
# in scripts/release.mjs (see header). Requires npm auth (NODE_AUTH_TOKEN / login).
npm-release: ## Build all platforms and publish to npmjs (version from git tag)
node scripts/release.mjs
# Same as npm-release but `npm publish --dry-run`: builds + packs every package,
# enforces the rails, uploads nothing. Use this to rehearse a release.
npm-release-dry: ## Rehearse a release (build + pack, no upload)
node scripts/release.mjs --dry-run