Skip to content

Commit 3c66893

Browse files
fail if package.json not updated
1 parent ba1fdac commit 3c66893

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.github/actions/set-version/action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,18 @@ runs:
1515
fi
1616
# Strip leading 'v' if present
1717
VERSION="${BRANCH_NAME#v}"
18+
19+
# Get version from package.json
20+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
21+
22+
# Verify versions match
23+
if [ "$VERSION" != "$PACKAGE_VERSION" ]; then
24+
echo "Error: Version mismatch!"
25+
echo " Branch version: $VERSION"
26+
echo " package.json version: $PACKAGE_VERSION"
27+
echo "Please ensure the branch name matches the version in package.json"
28+
exit 1
29+
fi
30+
1831
echo "VERSION=$VERSION" >> $GITHUB_ENV
1932
echo "Using version: $VERSION (from branch: $BRANCH_NAME)"

0 commit comments

Comments
 (0)