Skip to content

Commit 07c1ae5

Browse files
committed
better release process
1 parent e3a427f commit 07c1ae5

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ before:
1616
builds:
1717
- id: smoothdb
1818
ldflags:
19-
- -s -w -X main.Version={{ .Version }}
19+
- -s -w -X github.com/sted/smoothdb/version.Version={{ .Tag }}
2020
env:
2121
- CGO_ENABLED=0
2222
goarch:

Makefile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

2-
VERSION=$(shell git describe --tags `git rev-list --tags --max-count=1`)
3-
GO=go
4-
TEST_FLAGS=-v -count=1 -race
2+
VERSION := $(shell git describe --tags --always --dirty)
3+
GO = go
4+
TEST_FLAGS = -v -count=1 -race
5+
TAG = v$(patsubst v%,%,$(V))
56

67
all: build
78

@@ -24,7 +25,17 @@ prepare-postgrest-tests:
2425
psql -U postgres -c "create database pgrest" && \
2526
psql -U postgres -f ./test/postgrest/fixtures/load.sql pgrest
2627

28+
# Tag a release and push it to GitHub, where the goreleaser workflow
29+
# builds and publishes the bundles.
30+
# Usage: make release V=0.7.0
31+
release:
32+
@[ -n "$(V)" ] || { echo "usage: make release V=x.y.z"; exit 1; }
33+
@git diff-index --quiet HEAD -- || { echo "error: working tree not clean"; exit 1; }
34+
@[ "$$(git branch --show-current)" = "main" ] || { echo "error: not on branch main"; exit 1; }
35+
git tag -a $(TAG) -m "Release $(TAG)"
36+
git push origin main $(TAG)
37+
2738
clean:
28-
go clean
39+
$(GO) clean
2940

30-
.PHONY: all build build-ui build-go clean test
41+
.PHONY: all build build-ui build-go test prepare-postgrest-tests release clean

0 commit comments

Comments
 (0)