mirror of
https://github.com/KeymonSoft/Kelloggs_v4.git
synced 2026-04-17 18:26:11 +00:00
Version 5.12.15.test
PRUEBA
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
# --- SCRIPT DE AUTODESCUBRIMIENTO CON COMILLAS CORREGIDAS ---
|
# --- SCRIPT DE AUTODESCUBRIMIENTO (VERSIÓN FORMATO SEGURO) ---
|
||||||
|
|
||||||
# 1. ¿DÓNDE ESTOY?
|
# 1. AUTODESCUBRIMIENTO
|
||||||
$projectPath = $PSScriptRoot
|
$projectPath = $PSScriptRoot
|
||||||
Write-Host "Buscando proyecto en: $projectPath"
|
Write-Host "Ruta base: $projectPath"
|
||||||
|
|
||||||
# 2. BUSCAR EL ARCHIVO .B4A
|
|
||||||
$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) {
|
||||||
@@ -17,47 +16,33 @@ $b4aFile = $b4aFileItem.FullName
|
|||||||
$projectName = $b4aFileItem.BaseName
|
$projectName = $b4aFileItem.BaseName
|
||||||
Write-Host "Proyecto: $projectName"
|
Write-Host "Proyecto: $projectName"
|
||||||
|
|
||||||
# --- 3. LIMPIEZA DE PROYECTO ---
|
# 3. LEER VERSIÓN
|
||||||
#$objectsPath = Join-Path $projectPath "Objects"
|
|
||||||
#if (Test-Path $objectsPath) {
|
|
||||||
# Write-Host "Limpiando carpeta Objects..."
|
|
||||||
# Remove-Item -Path "$objectsPath\*" -Recurse -Force -ErrorAction SilentlyContinue
|
|
||||||
#}
|
|
||||||
|
|
||||||
# --- 4. LEER VERSIÓN ---
|
|
||||||
$versionLine = Get-Content $b4aFile | Select-String "#VersionName:"
|
$versionLine = Get-Content $b4aFile | Select-String "#VersionName:"
|
||||||
if (-Not $versionLine) {
|
if (-Not $versionLine) { Write-Error "Falta #VersionName"; return }
|
||||||
Write-Error "Falta #VersionName"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
$version = ($versionLine -split ":")[1].Trim()
|
$version = ($versionLine -split ":")[1].Trim()
|
||||||
$tagName = "v$version"
|
$tagName = "v$version"
|
||||||
|
|
||||||
Set-Location $projectPath
|
Set-Location $projectPath
|
||||||
|
|
||||||
# --- 5. EJECUTAR COMMIT ---
|
# 4. PREPARAR ARGUMENTOS (USANDO FORMATO SEGURO -f)
|
||||||
|
# Esto evita errores de sintaxis con comillas
|
||||||
|
$pathArg = '/path:"{0}"' -f $projectPath
|
||||||
|
$msgArg = '/logmsg:"Version {0}"' -f $version
|
||||||
|
$cmdArg = "/command:commit"
|
||||||
|
|
||||||
|
# 5. EJECUTAR COMMIT
|
||||||
$oldCommit = git rev-parse HEAD
|
$oldCommit = git rev-parse HEAD
|
||||||
|
|
||||||
Write-Host "----------------------------------------"
|
Write-Host "----------------------------------------"
|
||||||
Write-Host "Versión: $version"
|
Write-Host "Version: $version"
|
||||||
Write-Host "Abriendo TortoiseGit..."
|
Write-Host "Abriendo TortoiseGit..."
|
||||||
|
|
||||||
# --- CORRECCIÓN AQUÍ: AGREGAMOS COMILLAS EXPLICITAS ---
|
# Pasamos la lista limpia de argumentos
|
||||||
# Usamos `" para que Tortoise reciba la ruta entre comillas
|
$process = Start-Process "TortoiseGitProc.exe" -ArgumentList $cmdArg, $pathArg, $msgArg -Wait -PassThru
|
||||||
$tortoiseArgs = @(
|
|
||||||
"/command:commit",
|
|
||||||
"/path:`"$projectPath`"",
|
|
||||||
"/logmsg:`"Version $version`""
|
|
||||||
)
|
|
||||||
|
|
||||||
# Debug para que veas cómo queda ahora
|
|
||||||
Write-Host "Comando: TortoiseGitProc.exe $tortoiseArgs"
|
|
||||||
|
|
||||||
$process = Start-Process "TortoiseGitProc.exe" -ArgumentList $tortoiseArgs -Wait -PassThru
|
|
||||||
|
|
||||||
$newCommit = git rev-parse HEAD
|
$newCommit = git rev-parse HEAD
|
||||||
|
|
||||||
# --- 6. LOGICA DE TAGS Y PUSH ---
|
# 6. VERIFICAR CAMBIOS
|
||||||
if ($oldCommit -eq $newCommit) {
|
if ($oldCommit -eq $newCommit) {
|
||||||
Write-Warning "Commit cancelado o sin cambios."
|
Write-Warning "Commit cancelado o sin cambios."
|
||||||
Start-Sleep -Seconds 2
|
Start-Sleep -Seconds 2
|
||||||
@@ -66,30 +51,37 @@ if ($oldCommit -eq $newCommit) {
|
|||||||
|
|
||||||
Write-Host ">> Commit detectado."
|
Write-Host ">> Commit detectado."
|
||||||
|
|
||||||
|
# 7. GESTIÓN DE TAGS
|
||||||
$remoteTagInfo = git ls-remote --tags origin $tagName
|
$remoteTagInfo = git ls-remote --tags origin $tagName
|
||||||
|
|
||||||
if ($remoteTagInfo) {
|
if ($remoteTagInfo) {
|
||||||
Write-Warning "AVISO: El tag '$tagName' YA EXISTE en GitHub."
|
# Alerta Sonora y Visual
|
||||||
$confirm = Read-Host ">> ¿Deseas SOBRESCRIBIRLO? (s/n)"
|
[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") {
|
if ($confirm -eq "s") {
|
||||||
|
# Borrar y recrear forzando
|
||||||
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)..."
|
Write-Host "Subiendo (Force)..."
|
||||||
git push origin
|
git push origin
|
||||||
git push origin $tagName --force
|
git push origin $tagName --force
|
||||||
Write-Host ">> Tag actualizado."
|
Write-Host ">> Tag actualizado." -ForegroundColor Green
|
||||||
} else {
|
} else {
|
||||||
git push origin
|
git push origin
|
||||||
Write-Host ">> Código subido (Tag no actualizado)."
|
Write-Host ">> Codigo subido (Tag no actualizado)."
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
# Tag nuevo
|
||||||
git tag -a $tagName -m "Release version $version"
|
git tag -a $tagName -m "Release version $version"
|
||||||
Write-Host "Subiendo..."
|
Write-Host "Subiendo..."
|
||||||
git push origin --follow-tags
|
git push origin --follow-tags
|
||||||
Write-Host ">> Versión publicada."
|
Write-Host ">> Version publicada." -ForegroundColor Green
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "----------------------------------------"
|
Write-Host "----------------------------------------"
|
||||||
Start-Sleep -Seconds 3
|
Write-Host "Cerrando en 5 segundos..."
|
||||||
|
Start-Sleep -Seconds 5
|
||||||
Reference in New Issue
Block a user