@@ -15,13 +15,13 @@ help:
1515 @echo " "
1616 @echo " Release (RC):"
1717 @echo " make release-rc [VERSION=X.X.X-rc.X] - Create RC release (interactive)"
18- @echo " make publish-rc - Publish RC to npm (with confirmation )"
18+ @echo " make publish-rc - Publish RC (git commit/tag/push + npm )"
1919 @echo " "
2020 @echo " Release (Stable):"
2121 @echo " make release-patch - Bump patch version (1.0.0 -> 1.0.1, interactive)"
2222 @echo " make release-minor - Bump minor version (1.0.0 -> 1.1.0, interactive)"
2323 @echo " make release-major - Bump major version (1.0.0 -> 2.0.0, interactive)"
24- @echo " make publish - Publish stable to npm (with confirmation )"
24+ @echo " make publish - Publish stable (git commit/tag/push + npm )"
2525 @echo " "
2626 @echo " Note: All release commands are interactive and will:"
2727 @echo " - Show current and new version"
@@ -104,12 +104,8 @@ release-rc:
104104 echo " ✓ Version updated to $$ VERSION" ; \
105105 echo " ✓ Library built successfully" ; \
106106 echo " " ; \
107- echo " Next steps (manual):" ; \
108- echo " 1. Review changes: git status && git diff" ; \
109- echo " 2. Commit: git add . && git commit -m 'chore: release $$ VERSION'" ; \
110- echo " 3. Tag: git tag v$$ VERSION" ; \
111- echo " 4. Push: git push origin main && git push origin v$$ VERSION" ; \
112- echo " 5. Publish: make publish-rc"
107+ echo " Next step:" ; \
108+ echo " make publish-rc # Will handle git commit, tag, push, and npm publish"
113109
114110release-patch :
115111 @CURRENT=$$(npm pkg get version | tr -d '"' ) ; \
@@ -196,13 +192,38 @@ publish-rc:
196192 echo " 📦 Version: $$ VERSION" ; \
197193 echo " 📦 Tag: rc" ; \
198194 echo " " ; \
199- echo " ⚠️ This will publish to npm registry" ; \
195+ echo " ⚠️ This will:" ; \
196+ echo " 1. Commit changes (if any)" ; \
197+ echo " 2. Create git tag v$$ VERSION" ; \
198+ echo " 3. Push to origin" ; \
199+ echo " 4. Publish to npm registry" ; \
200+ echo " " ; \
200201 read -p " Continue? (y/N): " confirm; \
201202 if [ " $$ confirm" != " y" ] && [ " $$ confirm" != " Y" ]; then \
202203 echo " ❌ Publish cancelled" ; \
203204 exit 1; \
204205 fi ; \
205206 echo " " ; \
207+ echo " 🔍 Checking git status..." ; \
208+ if [ -n " $$ (git status --porcelain)" ]; then \
209+ echo " 📝 Staging changes..." ; \
210+ git add . ; \
211+ echo " 💾 Committing changes..." ; \
212+ git commit -m " chore: release $$ VERSION" || echo " ⚠️ Commit failed or nothing to commit" ; \
213+ else \
214+ echo " ✓ No uncommitted changes" ; \
215+ fi ; \
216+ if ! git rev-parse " v$$ VERSION" > /dev/null 2>&1 ; then \
217+ echo " 🏷️ Creating git tag v$$ VERSION..." ; \
218+ git tag v$$ VERSION; \
219+ else \
220+ echo " ⚠️ Tag v$$ VERSION already exists" ; \
221+ fi ; \
222+ echo " 📤 Pushing to origin..." ; \
223+ git push origin main 2> /dev/null || git push origin master 2> /dev/null || echo " ⚠️ Push failed or already up to date" ; \
224+ git push origin v$$ VERSION 2> /dev/null || echo " ⚠️ Tag push failed or already exists" ; \
225+ echo " " ; \
226+ echo " 📦 Publishing to npm..." ; \
206227 npm publish --tag rc --access public; \
207228 echo " " ; \
208229 echo " ✅ Published @authorizerdev/authorizer-react@$$ VERSION to npm with 'rc' tag!"
@@ -219,13 +240,38 @@ publish:
219240 echo " 📦 Version: $$ VERSION" ; \
220241 echo " 📦 Tag: latest" ; \
221242 echo " " ; \
222- echo " ⚠️ This will publish to npm registry as latest" ; \
243+ echo " ⚠️ This will:" ; \
244+ echo " 1. Commit changes (if any)" ; \
245+ echo " 2. Create git tag v$$ VERSION" ; \
246+ echo " 3. Push to origin" ; \
247+ echo " 4. Publish to npm registry as latest" ; \
248+ echo " " ; \
223249 read -p " Continue? (y/N): " confirm; \
224250 if [ " $$ confirm" != " y" ] && [ " $$ confirm" != " Y" ]; then \
225251 echo " ❌ Publish cancelled" ; \
226252 exit 1; \
227253 fi ; \
228254 echo " " ; \
255+ echo " 🔍 Checking git status..." ; \
256+ if [ -n " $$ (git status --porcelain)" ]; then \
257+ echo " 📝 Staging changes..." ; \
258+ git add . ; \
259+ echo " 💾 Committing changes..." ; \
260+ git commit -m " chore: release $$ VERSION" || echo " ⚠️ Commit failed or nothing to commit" ; \
261+ else \
262+ echo " ✓ No uncommitted changes" ; \
263+ fi ; \
264+ if ! git rev-parse " v$$ VERSION" > /dev/null 2>&1 ; then \
265+ echo " 🏷️ Creating git tag v$$ VERSION..." ; \
266+ git tag v$$ VERSION; \
267+ else \
268+ echo " ⚠️ Tag v$$ VERSION already exists" ; \
269+ fi ; \
270+ echo " 📤 Pushing to origin..." ; \
271+ git push origin main 2> /dev/null || git push origin master 2> /dev/null || echo " ⚠️ Push failed or already up to date" ; \
272+ git push origin v$$ VERSION 2> /dev/null || echo " ⚠️ Tag push failed or already exists" ; \
273+ echo " " ; \
274+ echo " 📦 Publishing to npm..." ; \
229275 npm publish --access public; \
230276 echo " " ; \
231277 echo " ✅ Published @authorizerdev/authorizer-react@$$ VERSION to npm!"
0 commit comments