Skip to content

Commit

Permalink
feat: Adding auto bumping
Browse files Browse the repository at this point in the history
Signed-off-by: Akis Maziotis <[email protected]>
  • Loading branch information
phoinixgrr committed Feb 29, 2024
1 parent 3ee9050 commit f934e68
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
35 changes: 34 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ GO_LDFLAGS += -X "github.com/mattermost/${APP_NAME}/internal/v
GO_LDFLAGS += -X "github.com/mattermost/${APP_NAME}/internal/version.gitTreeState=$(GIT_TREESTATE)"
GO_LDFLAGS += -X "github.com/mattermost/${APP_NAME}/internal/version.buildDate=$(BUILD_DATE)"


# Architectures to build for
GO_BUILD_PLATFORMS ?= linux-amd64 linux-arm64 freebsd-amd64
GO_BUILD_PLATFORMS_ARTIFACTS = $(foreach cmd,$(addprefix go-build/,${APP_NAME}),$(addprefix $(cmd)-,$(GO_BUILD_PLATFORMS)))
Expand Down Expand Up @@ -138,6 +137,14 @@ AT_0 := @
AT_1 :=
AT = $(AT_$(VERBOSE))

# ====================================================================================
# Used for semver bumping
CURRENT_VERSION := $(shell git describe --abbrev=0 --tags)
VERSION_PARTS := $(subst ., ,$(subst v,,$(CURRENT_VERSION)))
MAJOR := $(word 1,$(VERSION_PARTS))
MINOR := $(word 2,$(VERSION_PARTS))
PATCH := $(word 3,$(VERSION_PARTS))

# ====================================================================================
# Targets

Expand All @@ -164,6 +171,32 @@ lint: go-lint docker-lint ## to lint
.PHONY: test
test: go-test ## to test


.PHONY: patch minor major

patch: ## to bump patch version (semver)
@$(eval PATCH := $(shell echo $$(($(PATCH)+1))))
@$(INFO) Bumping $(APP_NAME) to Patch version $(MAJOR).$(MINOR).$(PATCH)
git tag -s -a $(MAJOR).$(MINOR).$(PATCH) -m "Bumping $(APP_NAME) to Patch version $(MAJOR).$(MINOR).$(PATCH)"
git push --tags
@$(OK) Bumping $(APP_NAME) to Patch version $(MAJOR).$(MINOR).$(PATCH)

minor: ## to bump minor version (semver)
@$(eval MINOR := $(shell echo $$(($(MINOR)+1))))
@$(INFO) Bumping $(APP_NAME) to Minor version $(MAJOR).$(MINOR).0
git tag -s -a $(MAJOR).$(MINOR).0 -m "Bumping $(APP_NAME) to Minor version $(MAJOR).$(MINOR).0"
git push --tags
@$(OK) Bumping $(APP_NAME) to Minor version $(MAJOR).$(MINOR).0

major: ## to bump major version (semver)
$(eval MAJOR := $(shell echo $$(($(MAJOR)+1))))
$(eval MINOR := 0)
$(eval PATCH := 0)
@$(INFO) Bumping $(APP_NAME) to Major version $(MAJOR).$(MINOR).$(PATCH)
git tag -s -a $(MAJOR).$(MINOR).$(PATCH) -m "Bumping $(APP_NAME) to Major version $(MAJOR).$(MINOR).$(PATCH)"
git push --tags
@$(OK) Bumping $(APP_NAME) to Major version $(MAJOR).$(MINOR).$(PATCH)

package-software: ## to package the binary
@$(INFO) Packaging
$(AT) for file in $(GO_OUT_BIN_DIR)/mattermost-push-proxy-*; do \
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# Mattermost Push Proxy ![CircleCI branch](https://img.shields.io/circleci/project/github/mattermost/mattermost-push-proxy/master.svg)

See https://developers.mattermost.com/contribute/mobile/push-notifications/service/


# How to Release

To trigger a release of Mattermost Push-Proxy, follow these steps:

1. **For Patch Release:** Run the following command:
```
make patch
```
This will release a patch change.

2. **For Minor Release:** Run the following command:
```
make minor
```
This will release a minor change.

3. **For Major Release:** Run the following command:
```
make major
```
This will release a major change.

0 comments on commit f934e68

Please sign in to comment.