mirror of
https://github.com/GabrielVidal1/ask-form.git
synced 2026-12-01 18:07:27 +01:00
ask-form (a node launcher) + ask-form-<os>-<arch> (the release's Go binary), laid out by scripts/npm-packages.sh and published by scripts/npm-publish.sh (skips versions already there, --tag next for prereleases, --trust sets up trusted publishing). release.yml runs it after the GitHub release: OIDC trusted publishing, else NPM_TOKEN; a failure never holds the release back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
1.3 KiB
Makefile
34 lines
1.3 KiB
Makefile
GO ?= go
|
|
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
|
MODULE := $(shell $(GO) list -m 2>/dev/null)
|
|
LDFLAGS := -s -w -X $(MODULE)/internal/server.Version=$(VERSION)
|
|
PLATFORMS ?= linux/amd64 linux/arm64 darwin/amd64 darwin/arm64
|
|
|
|
.PHONY: build test install dist npm relay-image
|
|
|
|
build: ## both binaries into bin/
|
|
$(GO) build -trimpath -ldflags "$(LDFLAGS)" -o bin/ ./cmd/...
|
|
|
|
test:
|
|
$(GO) vet ./... && $(GO) test ./...
|
|
|
|
install: ## ask-form into $(GOBIN) or ~/go/bin
|
|
$(GO) install -trimpath -ldflags "$(LDFLAGS)" ./cmd/ask-form
|
|
|
|
dist: ## release binaries for $(PLATFORMS) + checksums.txt into dist/
|
|
rm -rf dist && mkdir -p dist
|
|
for p in $(PLATFORMS); do \
|
|
os=$${p%/*}; arch=$${p#*/}; ext=; [ "$$os" = windows ] && ext=.exe; \
|
|
for b in ask-form ask-form-relay; do \
|
|
CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch $(GO) build -trimpath -ldflags "$(LDFLAGS)" \
|
|
-o dist/$$b-$$os-$$arch$$ext ./cmd/$$b || exit 1; \
|
|
done; \
|
|
done
|
|
cd dist && sha256sum ask-form* > checksums.txt
|
|
|
|
npm: dist ## the npm packages (ask-form + one per platform) into dist/npm/
|
|
scripts/npm-packages.sh $(VERSION) dist dist/npm
|
|
|
|
relay-image: ## the relay's container image
|
|
docker build --build-arg VERSION=$(VERSION) -t ask-form-relay:local .
|