2020-02-24 17:04:33 -06:00
|
|
|
VERSION?=$(shell git describe --tags --dirty | cut -c 2-)
|
2019-01-12 22:45:25 -06:00
|
|
|
IS_SNAPSHOT = $(if $(findstring -, $(VERSION)),true,false)
|
2020-02-24 17:04:33 -06:00
|
|
|
MAJOR_VERSION = $(word 1, $(subst ., ,$(VERSION)))
|
|
|
|
MINOR_VERSION = $(word 2, $(subst ., ,$(VERSION)))
|
|
|
|
PATCH_VERSION = $(word 3, $(subst ., ,$(word 1,$(subst -, , $(VERSION)))))
|
|
|
|
NEW_VERSION ?= $(MAJOR_VERSION).$(MINOR_VERSION).$(shell echo $$(( $(PATCH_VERSION) + 1)) )
|
2019-01-12 22:45:25 -06:00
|
|
|
|
2020-02-24 16:43:03 -06:00
|
|
|
ACT ?= go run main.go
|
2019-02-07 11:39:04 -06:00
|
|
|
export GITHUB_TOKEN = $(shell cat ~/.config/github/token)
|
2019-01-15 19:41:02 -06:00
|
|
|
|
2020-02-24 17:04:33 -06:00
|
|
|
build:
|
|
|
|
go build -ldflags "-X main.version=$(VERSION)" -o dist/local/act main.go
|
2019-01-12 22:45:25 -06:00
|
|
|
|
2020-02-24 17:04:33 -06:00
|
|
|
test:
|
2020-02-25 00:11:33 -06:00
|
|
|
$(ACT)
|
2019-01-17 02:45:37 -06:00
|
|
|
|
2019-01-12 22:45:25 -06:00
|
|
|
install: build
|
2020-02-24 17:04:33 -06:00
|
|
|
@cp dist/local/act /usr/local/bin/act
|
2019-01-12 22:45:25 -06:00
|
|
|
@chmod 755 /usr/local/bin/act
|
|
|
|
@act --version
|
|
|
|
|
|
|
|
installer:
|
|
|
|
@GO111MODULE=off go get github.com/goreleaser/godownloader
|
|
|
|
godownloader -r nektos/act -o install.sh
|
|
|
|
|
2019-01-23 13:51:22 -06:00
|
|
|
promote: vendor
|
2020-02-24 17:04:33 -06:00
|
|
|
@git fetch --tags
|
|
|
|
@echo "VERSION:$(VERSION) IS_SNAPSHOT:$(IS_SNAPSHOT) NEW_VERSION:$(NEW_VERSION)"
|
2019-01-12 22:45:25 -06:00
|
|
|
ifeq (false,$(IS_SNAPSHOT))
|
|
|
|
@echo "Unable to promote a non-snapshot"
|
|
|
|
@exit 1
|
|
|
|
endif
|
|
|
|
ifneq ($(shell git status -s),)
|
|
|
|
@echo "Unable to promote a dirty workspace"
|
|
|
|
@exit 1
|
|
|
|
endif
|
2020-02-24 17:04:33 -06:00
|
|
|
git tag -a -m "releasing v$(NEW_VERSION)" v$(NEW_VERSION)
|
|
|
|
git push origin v$(NEW_VERSION)
|
2019-01-23 13:51:22 -06:00
|
|
|
|
|
|
|
vendor:
|
2019-02-07 00:36:08 -06:00
|
|
|
go mod vendor
|
2019-01-23 13:51:22 -06:00
|
|
|
|
2020-02-10 17:27:05 -06:00
|
|
|
.PHONY: vendor
|