Skip to content

Commit

Permalink
Added release script
Browse files Browse the repository at this point in the history
  • Loading branch information
ZerGo0 committed Sep 25, 2024
1 parent 494a855 commit 8514ba3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ endef
$(foreach dep, $(GO_DEPENDENCIES), $(eval $(call make-go-dependency, $(dep))))
ci: lint-reports test-reports govulncheck ## Executes vulnerability scan, lint, test and generates reports

release: ## Generates and publishes a release
@./release.sh

help: ## Shows the help
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
@echo ''
Expand Down
23 changes: 23 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

# make sure that the repo is clean
DIRTY=$(git status --porcelain)
if [ ! -z "$DIRTY" ]; then
echo "Repo is not clean"
exit 1
fi

git pull origin master

# get the latest tag
LATEST_TAG=$(git describe --abbrev=0 --tags)

# increment the minor version
NEXT_VERSION=$(echo $LATEST_TAG | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF+1)%(10^length($NF))); print}')

echo "New version: $NEXT_VERSION"

git tag -a "$NEXT_VERSION" -m "Version $NEXT_VERSION"
git push origin "$NEXT_VERSION"

goreleaser release --clean

0 comments on commit 8514ba3

Please sign in to comment.