Merge branch 'release-target' into main
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 ./... |