#!/bin/bash

set -e

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

echo -e "${BLUE}🧪 Testing release detection logic...${NC}"

# Simulate the workflow logic
OLD_VERSION="1.0.1"
NEW_VERSION=$(node -p "require('./package.json').version")

echo -e "${YELLOW}📦 Old version: ${OLD_VERSION}${NC}"
echo -e "${YELLOW}📦 New version: ${NEW_VERSION}${NC}"

if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
    echo -e "${GREEN}✅ New release detected!${NC}"
    echo "new_release_published=true"
    echo "new_release_version=$NEW_VERSION"
else
    echo -e "${YELLOW}ℹ️ No new release detected${NC}"
    echo "new_release_published=false"
    echo "new_release_version="
fi

echo ""
echo -e "${BLUE}💡 This simulates the logic in the GitHub Actions workflow${NC}" 