Skip to content

🎧 Your Personal Streaming Service

Converted pre-push hook into a make target, avoid calling tests twice when releasing

Deluana99924ea200f
diff --git a/Makefile b/Makefile
index afec28da2..474d16538 100644
--- a/Makefile
+++ b/Makefile
@@ -86,13 +86,20 @@ buildall: check_env
go build -ldflags="-X github.com/deluan/navidrome/consts.gitSha=$(GIT_SHA) -X github.com/deluan/navidrome/consts.gitTag=$(GIT_TAG)-SNAPSHOT" -tags=embed
.PHONY: buildall
+pre-push:
+ golangci-lint run -v
+
+ @echo
+ make test
+.PHONY: pre-push
+
release:
@if [[ ! "${V}" =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$$ ]]; then echo "Usage: make release V=X.X.X"; exit 1; fi
go mod tidy
@if [ -n "`git status -s`" ]; then echo "\n\nThere are pending changes. Please commit or stash first"; exit 1; fi
- make test
+ make pre-push
git tag v${V}
- git push origin v${V}
+ git push origin v${V} --no-verify
.PHONY: release
snapshot:
diff --git a/git/pre-push b/git/pre-push
index 2d3acf253..da7eaba26 100755
--- a/git/pre-push
+++ b/git/pre-push
@@ -1,9 +1,4 @@
#!/bin/sh
set -e
-echo "#### Linting"
-golangci-lint run -v
-
-echo
-echo "#### Running tests"
-make test
\ No newline at end of file
+make pre-push
\ No newline at end of file