#!/bin/bash

set -e

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

echo -e "${YELLOW}🔧 Fixing semantic-release dependencies...${NC}"

# Install missing semantic-release plugins
echo -e "${YELLOW}📦 Installing semantic-release plugins...${NC}"
npm install --save-dev \
  @semantic-release/commit-analyzer@^11.0.0 \
  @semantic-release/git@^12.0.0 \
  @semantic-release/release-notes-generator@^12.0.0

echo -e "${GREEN}✅ semantic-release plugins installed successfully!${NC}"

# Verify installation
echo -e "${YELLOW}🔍 Verifying semantic-release configuration...${NC}"
npx semantic-release --dry-run

echo -e "${GREEN}✅ semantic-release is now properly configured!${NC}"
echo -e "${BLUE}💡 You can now run your GitHub Actions workflow again.${NC}" 