publish-now.ps1

# Publish Bluscream-BuildTools Module to PowerShell Gallery

Write-Host "=== Publishing Bluscream-BuildTools Module ===" -ForegroundColor Cyan

try {
    # Check if API key exists
    if (-not $env:PSGALLERY_KEY) {
        Write-Host "Error: PSGALLERY_KEY environment variable not set" -ForegroundColor Red
        Write-Host "Please set your PowerShell Gallery API key:" -ForegroundColor Yellow
        Write-Host '$env:PSGALLERY_KEY = "your-api-key-here"' -ForegroundColor Gray
        exit 1
    }
    
    Write-Host "API Key found, proceeding with publish..." -ForegroundColor Green
    
    # Validate module first
    Write-Host "Validating module manifest..." -ForegroundColor Yellow
    $Manifest = Test-ModuleManifest "Bluscream-BuildTools.psd1"
    Write-Host "✓ Module manifest is valid" -ForegroundColor Green
    Write-Host "Module Version: $($Manifest.Version)" -ForegroundColor Gray
    
    # Publish the module
    Write-Host "Publishing module to PowerShell Gallery..." -ForegroundColor Yellow
    Publish-Module -Path . -NuGetApiKey $env:PSGALLERY_KEY -Repository PSGallery -Force
    
    Write-Host "✓ Module published successfully!" -ForegroundColor Green
    Write-Host "Module: Bluscream-BuildTools v$($Manifest.Version)" -ForegroundColor Cyan
    Write-Host "Repository: PowerShell Gallery" -ForegroundColor Gray
    
    Write-Host ""
    Write-Host "Users can now install with:" -ForegroundColor Yellow
    Write-Host "Install-Module Bluscream-BuildTools" -ForegroundColor Cyan
    
}
catch {
    Write-Host "Error publishing module: $_" -ForegroundColor Red
    Write-Host "Please check your API key and try again." -ForegroundColor Yellow
}