Skip to content

Commit ac26c4b

Browse files
authored
chore/add_tagging_script (#62)
* chore: added a Makefile action to assist in the tag process for subfolders * [CHORE] Added a Makefile action to generate the correct tag for the `client` subdir
1 parent 1753ce6 commit ac26c4b

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

Makefile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ HTTPS_GIT := https://github.com/cosmos/cosmos-sdk.git
1414
DOCKER := $(shell which docker)
1515
PROJECT_NAME = $(shell git remote get-url origin | xargs basename -s .git)
1616

17+
# Subdirectories for tagging
18+
SUBDIR_PREFIXES := api core errors store x/circuit x/evidence x/feegrant x/nft x/tx x/upgrade
19+
1720
# process build tags
1821
build_tags = netgo
1922
ifeq ($(LEDGER_ENABLED),true)
@@ -481,3 +484,44 @@ localnet-start: localnet-stop localnet-build-env localnet-build-nodes
481484
localnet-debug: localnet-stop localnet-build-dlv localnet-build-nodes
482485

483486
.PHONY: localnet-start localnet-stop localnet-debug localnet-build-env localnet-build-dlv localnet-build-nodes
487+
488+
###############################################################################
489+
### Tagging ###
490+
###############################################################################
491+
492+
# tag-client creates and pushes the special client tag with v2.0.0- prefix
493+
# Usage: make tag-client TAG=v1.2.3 (creates client/v2.0.0-v1.2.3)
494+
tag-client:
495+
ifndef TAG
496+
$(error TAG is required. Usage: make tag-client TAG=v1.2.3)
497+
endif
498+
@echo "Fetching latest tags from origin..."
499+
@git fetch origin --tags
500+
@echo "Creating client tag for $(TAG)..."
501+
@client_tag="client/v2.0.0-$(TAG)"; \
502+
echo "Creating tag: $$client_tag"; \
503+
git tag "$$client_tag" $(TAG); \
504+
echo "Pushing tag: $$client_tag"; \
505+
git push origin "$$client_tag"
506+
@echo "Successfully created and pushed client tag for $(TAG)"
507+
508+
# tag-subdirs creates and pushes tags with subdir prefixes for a given tag
509+
# Usage: make tag-subdirs TAG=v1.2.3
510+
# NOTE: This also automatically creates the special client tag
511+
tag-subdirs: tag-client
512+
ifndef TAG
513+
$(error TAG is required. Usage: make tag-subdirs TAG=v1.2.3)
514+
endif
515+
@echo "Fetching latest tags from origin..."
516+
@git fetch origin --tags
517+
@echo "Creating and pushing subdir tags for $(TAG)..."
518+
@for prefix in $(SUBDIR_PREFIXES); do \
519+
new_tag="$$prefix/$(TAG)"; \
520+
echo "Creating tag: $$new_tag"; \
521+
git tag "$$new_tag" $(TAG); \
522+
echo "Pushing tag: $$new_tag"; \
523+
git push origin "$$new_tag"; \
524+
done
525+
@echo "Successfully created and pushed all subdir tags for $(TAG)"
526+
527+
.PHONY: tag-subdirs tag-client

0 commit comments

Comments
 (0)