Version 5.12.15.test

PRUEBA
This commit is contained in:
2025-12-20 01:43:07 -06:00
parent 367ff75966
commit e72a1381d5

View File

@@ -1,14 +1,16 @@
# --- SCRIPT DE AUTODESCUBRIMIENTO (VERSIÓN FORMATO SEGURO) --- # --- SCRIPT DE AUTODESCUBRIMIENTO CON INTERFAZ VISUAL ---
# Cargar librería para mensajes visuales
Add-Type -AssemblyName System.Windows.Forms
# 1. AUTODESCUBRIMIENTO # 1. AUTODESCUBRIMIENTO
$projectPath = $PSScriptRoot $projectPath = $PSScriptRoot
Write-Host "Ruta base: $projectPath" Write-Host "Ruta: $projectPath"
$b4aFileItem = Get-ChildItem -Path $projectPath -Filter "*.b4a" | Select-Object -First 1 $b4aFileItem = Get-ChildItem -Path $projectPath -Filter "*.b4a" | Select-Object -First 1
if (-Not $b4aFileItem) { if (-Not $b4aFileItem) {
Write-Error "ERROR: No hay archivo .b4a en esta carpeta." [System.Windows.Forms.MessageBox]::Show("No hay archivo .b4a en esta carpeta.", "Error", "OK", "Error")
Read-Host "Enter para salir"
return return
} }
@@ -16,6 +18,13 @@ $b4aFile = $b4aFileItem.FullName
$projectName = $b4aFileItem.BaseName $projectName = $b4aFileItem.BaseName
Write-Host "Proyecto: $projectName" Write-Host "Proyecto: $projectName"
# 2. LIMPIEZA
# $objectsPath = Join-Path $projectPath "Objects"
# if (Test-Path $objectsPath) {
# Write-Host "Limpiando Objects..."
# Remove-Item -Path "$objectsPath\*" -Recurse -Force -ErrorAction SilentlyContinue
# }
# 3. LEER VERSIÓN # 3. LEER VERSIÓN
$versionLine = Get-Content $b4aFile | Select-String "#VersionName:" $versionLine = Get-Content $b4aFile | Select-String "#VersionName:"
if (-Not $versionLine) { Write-Error "Falta #VersionName"; return } if (-Not $versionLine) { Write-Error "Falta #VersionName"; return }
@@ -24,66 +33,61 @@ $tagName = "v$version"
Set-Location $projectPath Set-Location $projectPath
# 4. PREPARAR ARGUMENTOS (USANDO FORMATO SEGURO -f) # 4. COMMIT
# Esto evita errores de sintaxis con comillas $oldCommit = git rev-parse HEAD
Write-Host "----------------------------------------"
Write-Host "Versión: $version"
Write-Host "Abriendo TortoiseGit..."
# Argumentos limpios
$pathArg = '/path:"{0}"' -f $projectPath $pathArg = '/path:"{0}"' -f $projectPath
$msgArg = '/logmsg:"Version {0}"' -f $version $msgArg = '/logmsg:"Version {0}"' -f $version
$cmdArg = "/command:commit" $cmdArg = "/command:commit"
# 5. EJECUTAR COMMIT
$oldCommit = git rev-parse HEAD
Write-Host "----------------------------------------"
Write-Host "Version: $version"
Write-Host "Abriendo TortoiseGit..."
# Pasamos la lista limpia de argumentos
$process = Start-Process "TortoiseGitProc.exe" -ArgumentList $cmdArg, $pathArg, $msgArg -Wait -PassThru $process = Start-Process "TortoiseGitProc.exe" -ArgumentList $cmdArg, $pathArg, $msgArg -Wait -PassThru
$newCommit = git rev-parse HEAD $newCommit = git rev-parse HEAD
# 6. VERIFICAR CAMBIOS # 5. VALIDACIÓN
if ($oldCommit -eq $newCommit) { if ($oldCommit -eq $newCommit) {
Write-Warning "Commit cancelado o sin cambios." Write-Warning "Commit cancelado."
Start-Sleep -Seconds 2
return return
} }
Write-Host ">> Commit detectado." Write-Host ">> Commit detectado."
# 7. GESTIÓN DE TAGS # 6. GESTIÓN DE TAGS (VISUAL)
$remoteTagInfo = git ls-remote --tags origin $tagName $remoteTagInfo = git ls-remote --tags origin $tagName
if ($remoteTagInfo) { if ($remoteTagInfo) {
# Alerta Sonora y Visual # --- AQUÍ ESTÁ LA MAGIA: VENTANA EMERGENTE ---
[System.Console]::Beep(1000, 200) [System.Console]::Beep(1000, 200)
[System.Console]::Beep(1000, 200)
[System.Console]::Beep(1000, 200)
Write-Host " "
Write-Host "AVISO: El tag '$tagName' YA EXISTE en GitHub." -ForegroundColor Red -BackgroundColor Yellow
$confirm = Read-Host ">> Escribe 's' y Enter para SOBRESCRIBIRLO"
if ($confirm -eq "s") { $msgBody = "El tag '$tagName' YA EXISTE en GitHub.`n`n¿Deseas SOBRESCRIBIRLO?`n`nSí = Borrar anterior y actualizar.`nNo = Subir solo código (mantener tag viejo)."
# Borrar y recrear forzando $msgTitle = "Conflicto de Versiones - $projectName"
# Mostrar ventana Sí/No
$respuesta = [System.Windows.Forms.MessageBox]::Show($msgBody, $msgTitle, "YesNo", "Warning")
if ($respuesta -eq "Yes") {
Write-Host "Sobrescribiendo..."
git tag -d $tagName 2>$null git tag -d $tagName 2>$null
git tag -a $tagName -m "Release version $version (Updated)" git tag -a $tagName -m "Release version $version (Updated)"
Write-Host "Subiendo (Force)..."
git push origin git push origin
git push origin $tagName --force git push origin $tagName --force
Write-Host ">> Tag actualizado." -ForegroundColor Green Write-Host ">> Tag actualizado (Force Push)."
} else { } else {
Write-Host "Conservando tag anterior..."
git push origin git push origin
Write-Host ">> Codigo subido (Tag no actualizado)." Write-Host ">> Código subido."
} }
} else { } else {
# Tag nuevo # Tag Nuevo
git tag -a $tagName -m "Release version $version" git tag -a $tagName -m "Release version $version"
Write-Host "Subiendo..."
git push origin --follow-tags git push origin --follow-tags
Write-Host ">> Version publicada." -ForegroundColor Green Write-Host ">> Versión publicada."
} }
Write-Host "----------------------------------------" Write-Host "----------------------------------------"
Write-Host "Cerrando en 5 segundos..."
Start-Sleep -Seconds 5