ci(git-hooks): 👷 Update pre-push hooks to enforce code quality checks before allowing pushes
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
f9e35ab931
commit
e927c9a3ae
1 changed files with 3 additions and 3 deletions
|
|
@ -55,7 +55,7 @@ if [[ ! -f "$PACKAGE_JSON" ]]; then
|
|||
fi
|
||||
|
||||
# Extract current version using portable tools
|
||||
CURRENT_VERSION=$(grep -o '"version"[[:space:]]*:[[:space:]]*"[^"]*"' "$PACKAGE_JSON" | head -1 | sed 's/.*"\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)".*/\1/')
|
||||
CURRENT_VERSION=$(grep -o '"version"[[:space:]]*:[[:space:]]*"[^"]*"' "$PACKAGE_JSON" | head -1 | sed 's/.*"\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/')
|
||||
|
||||
if [[ -z "$CURRENT_VERSION" ]]; then
|
||||
log_error "Could not parse version from package.json"
|
||||
|
|
@ -74,10 +74,10 @@ log_info "Pushing to $BRANCH - bumping version: $CURRENT_VERSION -> $NEW_VERSION
|
|||
# Update package.json (preserve formatting, just replace version)
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
# macOS sed requires empty string for -i
|
||||
sed -i '' "s/\"version\"[[:space:]]*:[[:space:]]*\"$CURRENT_VERSION\"/\"version\": \"$NEW_VERSION\"/" "$PACKAGE_JSON"
|
||||
sed -i '' "s/\"version\"[[:space:]]*:[[:space:]]*\"$CURRENT_VERSION[^\"]*\"/\"version\": \"$NEW_VERSION\"/" "$PACKAGE_JSON"
|
||||
else
|
||||
# GNU sed
|
||||
sed -i "s/\"version\"[[:space:]]*:[[:space:]]*\"$CURRENT_VERSION\"/\"version\": \"$NEW_VERSION\"/" "$PACKAGE_JSON"
|
||||
sed -i "s/\"version\"[[:space:]]*:[[:space:]]*\"$CURRENT_VERSION[^\"]*\"/\"version\": \"$NEW_VERSION\"/" "$PACKAGE_JSON"
|
||||
fi
|
||||
|
||||
log_info "Updated $PACKAGE_JSON"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue