Merge remote-tracking branch 'origin/main' into native/server-release
# Conflicts: # .gitignore
2 files changed,
+26
−5
.gitignore+1 −0Makefile+25 −5
CI passed — run details
diff --git a/.gitignore b/.gitignore| index 7beebf7..2a88a1c 100644 |
| --- a/.gitignore |
| +++ b/.gitignore |
| @@ -29,3 +29,4 @@ native/apple/.build/ |
| native/apple/.swiftpm/ |
| native/build/ |
| native/ios/*.xcodeproj/ |
| +/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 |