Skip to content

Commit 45231f9

Browse files
committed
add git tagging to the end of the publish process
1 parent 3d5834c commit 45231f9

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

publish.sh

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,21 @@ fi
5353
echo "New version: $NEW_VERSION"
5454
echo ""
5555

56+
# ─── Confirm before continuing ────────────────────────────────────────────────
57+
58+
if [[ -t 0 ]]; then
59+
read -r -p "Continue with version bump to $NEW_VERSION? [y/N] " CONFIRM
60+
case "${CONFIRM:-}" in
61+
y|Y|yes|YES)
62+
;;
63+
*)
64+
echo "Cancelled."
65+
exit 0
66+
;;
67+
esac
68+
echo ""
69+
fi
70+
5671
# ─── Version parity check ────────────────────────────────────────────────────
5772

5873
TS_VER=$(grep '"version"' typescript/package.json | head -1 | sed 's/.*"\([0-9][^"]*\)".*/\1/')
@@ -278,21 +293,26 @@ else
278293
fi
279294
echo ""
280295

281-
# Git tag (only if not already tagged)
296+
# Git commit + tag after publish
282297
git add -A
283298
if ! git diff --cached --quiet; then
284299
git commit -m "release: v$NEW_VERSION"
285300
fi
286-
if ! git tag -l "v$NEW_VERSION" | grep -q .; then
287-
git tag "v$NEW_VERSION"
301+
302+
if git tag -l "v$NEW_VERSION" | grep -q .; then
303+
echo "Local tag v$NEW_VERSION already exists — deleting and recreating it."
304+
git tag -d "v$NEW_VERSION"
288305
fi
289306

307+
git tag "v$NEW_VERSION"
308+
290309
echo ""
291310
if [[ ${#FAILED[@]} -eq 0 ]]; then
292311
echo "Published v$NEW_VERSION to all registries."
293312
else
294313
echo "Published v$NEW_VERSION with ${#FAILED[@]} failure(s): ${FAILED[*]}"
295314
echo "Fix the above and re-run the individual publish commands."
296315
fi
297-
echo "Run 'git push && git push --tags' to push the release."
316+
echo "Created local git tag v$NEW_VERSION."
317+
echo "Run 'git push && git push --tags --force' if you need to replace an existing remote tag."
298318
fi

0 commit comments

Comments
 (0)