mirror of
https://github.com/KeymonSoft/Kelloggs_v4.git
synced 2026-04-21 20:09:13 +00:00
Version 5.12.15.test
This commit is contained in:
45
B4A/_git_tag.ps1
Normal file
45
B4A/_git_tag.ps1
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
param([string]$projectPath, [string]$projectName)
|
||||||
|
|
||||||
|
$b4aFile = Join-Path $projectPath "$projectName.b4a"
|
||||||
|
if (-Not (Test-Path $b4aFile)) { return }
|
||||||
|
|
||||||
|
# Extraer VersionName del código B4A [cite: 1495, 1502]
|
||||||
|
$versionLine = Get-Content $b4aFile | Select-String "#VersionName:"
|
||||||
|
$version = ($versionLine -split ":")[1].Trim()
|
||||||
|
$tagName = "v$version"
|
||||||
|
|
||||||
|
Set-Location $projectPath
|
||||||
|
$oldCommit = git rev-parse HEAD
|
||||||
|
|
||||||
|
# Abrir ventana de Commit de TortoiseGit [cite: 1226]
|
||||||
|
Write-Host "Esperando commit para version $version..."
|
||||||
|
$process = Start-Process "TortoiseGitProc.exe" -ArgumentList "/command:commit", "/path:`"$projectPath`"", "/logmsg:`"Version $version`"" -Wait -PassThru
|
||||||
|
|
||||||
|
$newCommit = git rev-parse HEAD
|
||||||
|
|
||||||
|
if ($oldCommit -ne $newCommit) {
|
||||||
|
# Verificar si el Tag ya existe en el servidor (GitHub)
|
||||||
|
$tagExistsRemote = git ls-remote --tags origin $tagName
|
||||||
|
|
||||||
|
if ($tagExistsRemote) {
|
||||||
|
$confirm = Read-Host "El tag $tagName ya existe en GitHub. ¿Deseas SOBRESCRIBIRLO? (s/n)"
|
||||||
|
if ($confirm -ne "s") {
|
||||||
|
Write-Warning "Proceso abortado. Cambia la version en B4A y repite el proceso."
|
||||||
|
return
|
||||||
|
}
|
||||||
|
# Borrar local y remoto para permitir la actualizacion
|
||||||
|
git tag -d $tagName 2>$null
|
||||||
|
git push origin --delete $tagName 2>$null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Crear nuevo Tag local
|
||||||
|
git tag -a $tagName -m "Release version $version"
|
||||||
|
|
||||||
|
# Subir cambios y el tag (usando -f solo para el tag si fuera necesario)
|
||||||
|
Write-Host "Subiendo cambios a GitHub..."
|
||||||
|
git push origin --follow-tags
|
||||||
|
|
||||||
|
Write-Host "¡Completado! Version $version actualizada en GitHub."
|
||||||
|
} else {
|
||||||
|
Write-Warning "Commit cancelado. No se realizaron cambios."
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user