mirror of
https://github.com/lukaszraczylo/semver-generator.git
synced 2026-07-05 03:54:46 +00:00
Allow semver generator to run without configuration file present.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
LOCAL_VERSION?=$(shell semver-gen generate -l -c config-release.yaml | sed -e 's|SEMVER ||g')
|
LOCAL_VERSION?=""
|
||||||
CI_RUN?=false
|
CI_RUN?=false
|
||||||
ADDITIONAL_BUILD_FLAGS=""
|
ADDITIONAL_BUILD_FLAGS=""
|
||||||
|
|
||||||
@@ -6,16 +6,31 @@ ifeq ($(CI_RUN), true)
|
|||||||
ADDITIONAL_BUILD_FLAGS="-test.short"
|
ADDITIONAL_BUILD_FLAGS="-test.short"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: build
|
ifneq ($(shell which semver-gen), "")
|
||||||
|
LOCAL_VERSION="0.0.0-dev"
|
||||||
|
else
|
||||||
|
LOCAL_VERSION=$(shell semver-gen generate -l -c config-release.yaml | sed -e 's|SEMVER ||g')
|
||||||
|
endif
|
||||||
|
|
||||||
build:
|
.PHONY: help
|
||||||
|
help: ## display this help
|
||||||
|
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: build ## Build all targets
|
||||||
|
|
||||||
|
.PHONY: build
|
||||||
|
build: ## Build binary
|
||||||
go build -o semver-gen -ldflags="-s -w -X main.PKG_VERSION=${LOCAL_VERSION}" *.go
|
go build -o semver-gen -ldflags="-s -w -X main.PKG_VERSION=${LOCAL_VERSION}" *.go
|
||||||
|
|
||||||
run: build
|
# .PHONY: run
|
||||||
@./semver-gen
|
# run: build ## Build binary and execute it
|
||||||
|
# @./semver-gen
|
||||||
|
|
||||||
test:
|
.PHONY: test
|
||||||
|
test: ## Run whole test suite
|
||||||
@go test ./... $(ADDITIONAL_BUILD_FLAGS) -v -race -cover -coverprofile=coverage.out
|
@go test ./... $(ADDITIONAL_BUILD_FLAGS) -v -race -cover -coverprofile=coverage.out
|
||||||
|
|
||||||
update:
|
.PHONY: update
|
||||||
|
update: ## Update all dependencies and sub-packages
|
||||||
@go get -u ./...
|
@go get -u ./...
|
||||||
|
|||||||
+1
-2
@@ -327,8 +327,7 @@ func main() {
|
|||||||
if repo.Generate || params.varGenerateInTest {
|
if repo.Generate || params.varGenerateInTest {
|
||||||
err := repo.ReadConfig(repo.LocalConfigFile)
|
err := repo.ReadConfig(repo.LocalConfigFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Unable to find config file", repo.LocalConfigFile)
|
fmt.Println("Unable to find config file semver.yaml. Using defaults and flags.", repo.LocalConfigFile)
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
err = repo.Prepare()
|
err = repo.Prepare()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user