oficina / memoria Public

make release: build a stamped linux-arm64 binary into releases/

Releases are published from a tag now, so the stamp a binary reports
from GET /api/version should be that tag. git describe --tags --always
resolves to it when the build sits on one and falls back to the short
sha it used to carry when it does not, so nothing is lost.

The artifact is named releases/<app>-linux-arm64 because amadan release
create uploads a file under its basename, and a release's files cannot
be deleted once they exist.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev c8eea5ebc6581c813236bb54991ca23351cd2fc3 parent aab25c0
1 file changed, +15 −2
  • Makefile +15 −2

CI passed — run details

diff --git a/Makefile b/Makefile
index f77e342..5104827 100644
--- a/Makefile
+++ b/Makefile
@@ -35,15 +35,28 @@ build:
# an unstamped binary answers "dev" from /api/version forever — which
# makes the deploy check structurally incapable of failing, since the
# thing it compares can never disagree.
+#
+# The stamp was a short sha because there were no tags to describe. Now
+# that a release IS a tag, git describe --tags --always answers with the
+# tag when the build sits on one and falls back to the same short sha
+# when it does not — so the reasoning above is unchanged, and a
+# published binary reports the name it was published under.
+VERSION ?= $(shell git describe --tags --always 2>/dev/null)
+
release:
@git diff --quiet && git diff --cached --quiet || \
{ echo "refusing to build a release from a dirty tree"; exit 1; }
+ @test -n "$(VERSION)" || \
+ { echo "make release: no version to stamp; commit, or name it: make release VERSION=v0.1.0"; exit 1; }
+ @mkdir -p releases
CGO_ENABLED=0 GOOS=$(RELEASE_GOOS) GOARCH=$(RELEASE_GOARCH) go build -trimpath \
- -ldflags "-s -w -X github.com/carlosframework/rastrillo.BuildVersion=$$(git rev-parse --short HEAD)" \
+ -ldflags "-s -w -X github.com/carlosframework/rastrillo.BuildVersion=$(VERSION)" \
-o $(RELEASE_BIN) ./cmd/$(APP)
- @echo "built $(RELEASE_BIN) stamped $$(git rev-parse --short HEAD)"
+ @echo "built $(RELEASE_BIN) reporting version $(VERSION)"
@echo "deploy it with:"
@echo " carlos deploy --app $(APP) --account bds --channel edge --timeout 5m $(RELEASE_BIN)"
+ @echo "publish it with:"
+ @echo " amadan release create -repo oficina/$(APP) -notes-file NOTES.md $(VERSION) $(RELEASE_BIN)"
test:
go test ./...