Files
gf/Makefile

78 lines
1.8 KiB
Makefile
Raw Permalink Normal View History

SHELL := /bin/bash
# execute "go mod tidy" on all folders that have go.mod file
.PHONY: tidy
tidy:
2025-03-09 22:31:20 +08:00
./.make_tidy.sh
# execute "golangci-lint" to check code style
.PHONY: lint
lint:
golangci-lint run -c .golangci.yml
# make branch to=v2.4.0
.PHONY: branch
branch:
@set -e; \
newVersion=$(to); \
if [ -z "$$newVersion" ]; then \
echo "Error: 'to' variable is required. Usage: make branch to=vX.Y.Z"; \
exit 1; \
fi; \
branchName=fix/$$newVersion; \
echo "Switching to master branch..."; \
git checkout master; \
echo "Pulling latest changes from master..."; \
git pull origin master; \
echo "Creating and switching to branch $$branchName from master..."; \
git checkout -b $$branchName; \
echo "Branch $$branchName created successfully!"
# make version to=v2.4.0
2023-04-24 11:44:19 +08:00
.PHONY: version
version:
@set -e; \
newVersion=$(to); \
2025-03-09 22:31:20 +08:00
./.make_version.sh ./ $$newVersion; \
2023-06-06 17:10:32 +08:00
echo "make version to=$(to) done"
2025-02-27 14:35:00 +08:00
# make tag to=v2.4.0
.PHONY: tag
tag:
@set -e; \
newVersion=$(to); \
echo "Switching to master branch..."; \
git checkout master; \
echo "Pulling latest changes from master..."; \
git pull origin master; \
echo "Creating annotated tag $$newVersion..."; \
git tag -a $$newVersion -m "Release $$newVersion"; \
echo "Pushing tag $$newVersion..."; \
git push origin $$newVersion; \
echo "Tag $$newVersion created and pushed successfully!"
2025-02-27 14:35:00 +08:00
# update submodules
.PHONY: subup
subup:
@set -e; \
echo "Updating submodules..."; \
git submodule init;\
git submodule update;
2025-02-27 14:35:00 +08:00
# update and commit submodules
.PHONY: subsync
subsync: subup
@set -e; \
echo "";\
cd examples; \
echo "Checking for changes..."; \
if git diff-index --quiet HEAD --; then \
echo "No changes to commit"; \
else \
echo "Found changes, committing..."; \
git add -A; \
git commit -m "examples update"; \
git push origin; \
fi; \
cd ..;