oficina / sheets 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 36c55aea38bbe6a8a5490d3ff630cc51f145bb15 parent fa8b940
2 files changed, +26 −5
  • .gitignore +1 −0
  • Makefile +25 −5

CI passed — run details

diff --git a/.gitignore b/.gitignore
index d30a32e..189890a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,4 @@
.claude/worktrees
.claude/HANDOFF.md
/sheets-arm64
+/releases/
diff --git a/Makefile b/Makefile
index 04e4959..d02bb33 100644
--- a/Makefile
+++ b/Makefile
@@ -18,14 +18,34 @@ build:
#
# A dirty tree is refused: the sha would name a commit that is not what
# is in the binary, which is worse than no stamp at all.
-RELEASE_OUT ?= ./sheets-arm64
+#
+# 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 nothing is lost and a published binary reports
+# the name it was published under.
+#
+# The artifact lands in releases/ under the name the publish step
+# expects: `amadan release create` uploads a file under its basename,
+# and that basename is what appears on the release page permanently.
+APP := sheets
+RELEASE_GOOS ?= linux
+RELEASE_GOARCH ?= arm64
+RELEASE_BIN := releases/$(APP)-$(RELEASE_GOOS)-$(RELEASE_GOARCH)
+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; }
- CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath \
- -ldflags "-s -w -X github.com/carlosframework/rastrillo.BuildVersion=$$(git rev-parse --short HEAD)" \
- -o $(RELEASE_OUT) ./cmd/sheets
- @echo "built $(RELEASE_OUT) stamped $$(git rev-parse --short HEAD)"
+ @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=$(VERSION)" \
+ -o $(RELEASE_BIN) ./cmd/$(APP)
+ @echo "built $(RELEASE_BIN) reporting version $(VERSION)"
+ @echo "publish it with:"
+ @echo " amadan release create -repo oficina/$(APP) -notes-file NOTES.md $(VERSION) $(RELEASE_BIN)"
# The gate, split into named targets so CI can report them individually
# (.amadan/ci.d calls these one at a time, each its own step). `make