You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve release script with version and changelog checks
Add logic to detect if CHANGELOG and version are already updated, offer
to reuse current version, and handle existing tags. Streamline commit
and tagging process for repeated releases. Remove VSCode extension notes
from CHANGELOG.
echo" 2) minor - New features (${CURRENT_VERSION} → $(npm version minor --no-git-tag-version | tail -1 && npm version ${CURRENT_VERSION} --no-git-tag-version >/dev/null 2>&1))"
29
-
echo" 3) major - Breaking changes (${CURRENT_VERSION} → $(npm version major --no-git-tag-version | tail -1 && npm version ${CURRENT_VERSION} --no-git-tag-version >/dev/null 2>&1))"
30
-
echo""
31
-
read -p "Enter choice (1-3): " BUMP_CHOICE
32
-
33
-
case$BUMP_CHOICEin
34
-
1) BUMP_TYPE="patch" ;;
35
-
2) BUMP_TYPE="minor" ;;
36
-
3) BUMP_TYPE="major" ;;
37
-
*)
38
-
echo -e "${RED}Invalid choice${NC}"
39
-
exit 1
40
-
;;
41
-
esac
42
-
43
-
# Bump version
44
-
echo""
45
-
echo -e "${BLUE}Bumping version...${NC}"
46
-
NEW_VERSION=$(npm version $BUMP_TYPE --no-git-tag-version)
47
-
NEW_VERSION=${NEW_VERSION#v}
24
+
# Check if CHANGELOG already has this version
25
+
if grep -q "## \[${CURRENT_VERSION}\]" ../CHANGELOG.md 2>/dev/null;then
26
+
echo -e "${YELLOW}⚠ CHANGELOG already updated for v${CURRENT_VERSION}${NC}"
27
+
echo""
28
+
read -p "Use current version v${CURRENT_VERSION} for release? (Y/n): " -n 1 -r
29
+
echo
30
+
if [[ $REPLY=~ ^[Nn]$ ]];then
31
+
USE_CURRENT=false
32
+
else
33
+
USE_CURRENT=true
34
+
fi
35
+
else
36
+
USE_CURRENT=false
37
+
fi
48
38
49
-
echo -e "New version: ${GREEN}v${NEW_VERSION}${NC}"
50
-
echo""
39
+
if [ "$USE_CURRENT"=true ];then
40
+
NEW_VERSION=$CURRENT_VERSION
41
+
echo -e "Using current version: ${GREEN}v${NEW_VERSION}${NC}"
0 commit comments