@@ -89,6 +89,41 @@ repl: ## Open MicroPython REPL on the board
8989mount : # # Mount lib/ on the board for live testing
9090 mpremote connect $(PORT ) mount lib/
9191
92+ # --- Release ---
93+
94+ PART ?= patch
95+
96+ .PHONY : bump
97+ bump : # # Create a version tag (PART=patch|minor|major, default: patch)
98+ @if [ " $$ (git symbolic-ref --short HEAD)" != " main" ]; then \
99+ echo " Error: bump must be run on the main branch." ; exit 1; \
100+ fi
101+ @if [ -n " $$ (git status --porcelain)" ]; then \
102+ echo " Error: working tree is not clean. Commit or stash changes first." ; exit 1; \
103+ fi
104+ @LAST=$$(git tag --sort=-v:refname | head -1 ) ; \
105+ if [ -z " $$ LAST" ]; then \
106+ NEXT=" v1.0.0" ; \
107+ else \
108+ MAJOR=$$(echo "$$LAST" | sed 's/^v//' | cut -d. -f1 ) ; \
109+ MINOR=$$(echo "$$LAST" | sed 's/^v//' | cut -d. -f2 ) ; \
110+ PATCH=$$(echo "$$LAST" | sed 's/^v//' | cut -d. -f3 ) ; \
111+ case " $( PART) " in \
112+ major) MAJOR=$$((MAJOR + 1 ) ); MINOR=0; PATCH=0 ;; \
113+ minor) MINOR=$$((MINOR + 1 ) ); PATCH=0 ;; \
114+ patch) PATCH=$$((PATCH + 1 ) ) ;; \
115+ * ) echo " Error: PART must be patch, minor or major." ; exit 1 ;; \
116+ esac ; \
117+ NEXT=" v$$ MAJOR.$$ MINOR.$$ PATCH" ; \
118+ fi ; \
119+ echo " $$ LAST → $$ NEXT" ; \
120+ sed -i " s/^version = \" .*\" /version = \" $$ {NEXT#v}\" /" pyproject.toml; \
121+ git add pyproject.toml; \
122+ git commit -m " chore: Bump version to $$ NEXT." ; \
123+ git tag " $$ NEXT" ; \
124+ git push origin main " $$ NEXT" ; \
125+ echo " Tag $$ NEXT pushed to origin."
126+
92127# --- Utilities ---
93128
94129.PHONY : clean
0 commit comments