Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

ver(core): x.x.x-preview
ver(gen): x.x.x-preview
ver(template): x.x.x-preview

## Notes:

Expand Down
42 changes: 39 additions & 3 deletions .github/workflows/dev-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,25 @@ jobs:
Write-Host "ver(gen) no encontrado - se omitira paquete Generators"
}

$templateVersion = $null
if ($prBody -match '(?i)ver\s*\(\s*template\s*\)\s*:\s*(\d+\.\d+\.\d+-preview)') {
$templateVersion = $matches[1]
Write-Host "ver(template): $templateVersion"
} else {
Write-Host "ver(template) no encontrado - se omitira paquete Templates"
}

# 2. Validar que al menos uno fue encontrado
if (-not $coreVersion -and -not $genVersion) {
if (-not $coreVersion -and -not $genVersion -and -not $templateVersion) {
Write-Host ""
Write-Host "No se encontro ninguna version valida. Workflow terminado."
echo "::warning::No se encontraron versiones en el PR body"
echo "SKIP_WORKFLOW=true" >> $env:GITHUB_OUTPUT
exit 0
}

# 3. Determinar version del Release (prioridad: Core > Generators)
$releaseVersion = if ($coreVersion) { $coreVersion } else { $genVersion }
# 3. Determinar version del Release (prioridad: Core > Generators > Templates)
$releaseVersion = if ($coreVersion) { $coreVersion } else { if ($genVersion) { $genVersion } else { $templateVersion } }

# 4. Construir cuerpo del Release en Markdown
$bodyMsg = "## Preview Release`n`nEsta es una version preview automatica desde development.`n`n### Paquetes publicados"
Expand All @@ -74,6 +82,9 @@ jobs:
if ($genVersion) {
$bodyMsg += "`n- **RandAMediaLabGroup.EasyWindowsApplication.Generators** ``$genVersion``"
}
if ($templateVersion) {
$bodyMsg += "`n- **RandAMediaLabGroup.EasyWindowsApplication.Templates** ``$templateVersion``"
}

$bodyMsg += "`n`n### PR Original`n$($env:PR_URL)"

Expand All @@ -89,17 +100,21 @@ jobs:
# Solo exportar versiones que existen para evitar <Version></Version> en .csproj
if ($coreVersion) { echo "CORE_VERSION=$coreVersion" >> $env:GITHUB_OUTPUT }
if ($genVersion) { echo "GEN_VERSION=$genVersion" >> $env:GITHUB_OUTPUT }
if ($templateVersion) { echo "TEMPLATE_VERSION=$templateVersion" >> $env:GITHUB_OUTPUT }

$hasCore = if ($coreVersion) { 'true' } else { 'false' }
$hasGen = if ($genVersion) { 'true' } else { 'false' }
$hasTemplate = if ($templateVersion) { 'true' } else { 'false' }
echo "HAS_CORE=$hasCore" >> $env:GITHUB_OUTPUT
echo "HAS_GEN=$hasGen" >> $env:GITHUB_OUTPUT
echo "HAS_TEMPLATE=$hasTemplate" >> $env:GITHUB_OUTPUT

Write-Host ""
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
Write-Host "RELEASE_VERSION : $releaseVersion"
Write-Host "HAS_CORE : $hasCore"
Write-Host "HAS_GEN : $hasGen"
Write-Host "HAS_TEMPLATE : $hasTemplate"
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

- name: Update project versions
Expand Down Expand Up @@ -128,6 +143,15 @@ jobs:
Write-Host "Generators omitido (no hay version)"
}

if ("${{ steps.extract_version.outputs.HAS_TEMPLATE }}" -eq "true") {
$version = "${{ steps.extract_version.outputs.TEMPLATE_VERSION }}"
$projFile = "src/ProjectTemplates/ProjectTemplates.csproj"
(Get-Content $projFile) -replace '<Version>.*</Version>', "<Version>$version</Version>" | Set-Content $projFile
Write-Host "Templates actualizado a: $version"
} else {
Write-Host "Templates omitido (no hay version)"
}

Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

- name: Setup .NET 10
Expand Down Expand Up @@ -168,6 +192,18 @@ jobs:
dotnet pack src/EasyWindowsApplication.Generators/EasyWindowsApplication.Generators.csproj --configuration Release --no-build --output ./nupkgs
if ($LASTEXITCODE -ne 0) { Write-Error "Pack fallido"; exit 1 }

- name: Build & Pack Templates package
if: steps.extract_version.outputs.SKIP_WORKFLOW != 'true' && steps.extract_version.outputs.HAS_TEMPLATE == 'true'
shell: pwsh
run: |
Write-Host "Restaurando Templates..."
dotnet restore src/ProjectTemplates/ProjectTemplates.csproj
if ($LASTEXITCODE -ne 0) { Write-Error "Restore fallido"; exit 1 }

Write-Host "Empaquetando Templates..."
dotnet pack src/ProjectTemplates/ProjectTemplates.csproj --configuration Release --no-restore --output ./nupkgs
if ($LASTEXITCODE -ne 0) { Write-Error "Pack fallido"; exit 1 }

- name: List generated packages
if: steps.extract_version.outputs.SKIP_WORKFLOW != 'true'
shell: pwsh
Expand Down
47 changes: 44 additions & 3 deletions .github/workflows/prod-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,29 @@ jobs:
Write-Host "ver(gen) no encontrado - se omitira paquete Generators"
}

$templatePreview = $null
$templateStable = $null
if ($prBody -match '(?i)ver\s*\(\s*template\s*\)\s*:\s*(\d+\.\d+\.\d+)-preview') {
$templatePreview = $matches[1] + "-preview"
$templateStable = $matches[1]
Write-Host "ver(template) encontrado"
Write-Host " Preview: $templatePreview"
Write-Host " Stable : $templateStable"
} else {
Write-Host "ver(template) no encontrado - se omitira paquete Templates"
}

# 2. Validar que al menos uno fue encontrado
if (-not $coreStable -and -not $genStable) {
if (-not $coreStable -and -not $genStable -and -not $templateStable) {
Write-Host ""
Write-Host "No se encontro ninguna version valida. Workflow terminado."
echo "::warning::No se encontraron versiones en el PR body"
echo "SKIP_WORKFLOW=true" >> $env:GITHUB_OUTPUT
exit 0
}

# 3. Determinar version del Release (prioridad: Core > Generators)
$releaseVersion = if ($coreStable) { $coreStable } else { $genStable }
# 3. Determinar version del Release (prioridad: Core > Generators > Templates)
$releaseVersion = if ($coreStable) { $coreStable } else { if ($genStable) { $genStable } else { $templateStable } }

# 4. Construir cuerpo del Release en Markdown
$bodyMsg = "## Stable Release`n`nEsta es una version estable promocionada desde preview.`n`n### Paquetes publicados"
Expand All @@ -82,6 +94,9 @@ jobs:
if ($genStable) {
$bodyMsg += "`n- **RandAMediaLabGroup.EasyWindowsApplication.Generators** ``$genStable`` (desde ``$genPreview``)"
}
if ($templateStable) {
$bodyMsg += "`n- **RandAMediaLabGroup.EasyWindowsApplication.Templates** ``$templateStable`` (desde ``$templatePreview``)"
}

$bodyMsg += "`n`n### PR Original`n$($env:PR_URL)"
$bodyMsg += "`n`n### Cambios`nVer el Pull Request para detalles completos de los cambios incluidos en esta version."
Expand All @@ -100,17 +115,22 @@ jobs:
if ($corePreview) { echo "CORE_PREVIEW=$corePreview" >> $env:GITHUB_OUTPUT }
if ($genStable) { echo "GEN_STABLE=$genStable" >> $env:GITHUB_OUTPUT }
if ($genPreview) { echo "GEN_PREVIEW=$genPreview" >> $env:GITHUB_OUTPUT }
if ($templateStable) { echo "TEMPLATE_STABLE=$templateStable" >> $env:GITHUB_OUTPUT }
if ($templatePreview) { echo "TEMPLATE_PREVIEW=$templatePreview" >> $env:GITHUB_OUTPUT }

$hasCore = if ($coreStable) { 'true' } else { 'false' }
$hasGen = if ($genStable) { 'true' } else { 'false' }
$hasTemplate = if ($templateStable) { 'true' } else { 'false' }
echo "HAS_CORE=$hasCore" >> $env:GITHUB_OUTPUT
echo "HAS_GEN=$hasGen" >> $env:GITHUB_OUTPUT
echo "HAS_TEMPLATE=$hasTemplate" >> $env:GITHUB_OUTPUT

Write-Host ""
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
Write-Host "RELEASE_VERSION : $releaseVersion"
Write-Host "HAS_CORE : $hasCore"
Write-Host "HAS_GEN : $hasGen"
Write-Host "HAS_TEMPLATE : $hasTemplate"
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

- name: Update project versions
Expand Down Expand Up @@ -139,6 +159,15 @@ jobs:
Write-Host "Generators omitido (no hay version)"
}

if ("${{ steps.extract_version.outputs.HAS_TEMPLATE }}" -eq "true") {
$version = "${{ steps.extract_version.outputs.TEMPLATE_STABLE }}"
$projFile = "src/ProjectTemplates/ProjectTemplates.csproj"
(Get-Content $projFile) -replace '<Version>.*</Version>', "<Version>$version</Version>" | Set-Content $projFile
Write-Host "Templates actualizado a: $version (STABLE)"
} else {
Write-Host "Templates omitido (no hay version)"
}

Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

- name: Setup .NET 10
Expand Down Expand Up @@ -179,6 +208,18 @@ jobs:
dotnet pack src/EasyWindowsApplication.Generators/EasyWindowsApplication.Generators.csproj --configuration Release --no-build --output ./nupkgs
if ($LASTEXITCODE -ne 0) { Write-Error "Pack fallido"; exit 1 }

- name: Build & Pack Templates package
if: steps.extract_version.outputs.SKIP_WORKFLOW != 'true' && steps.extract_version.outputs.HAS_TEMPLATE == 'true'
shell: pwsh
run: |
Write-Host "Restaurando Templates..."
dotnet restore src/ProjectTemplates/ProjectTemplates.csproj
if ($LASTEXITCODE -ne 0) { Write-Error "Restore fallido"; exit 1 }

Write-Host "Empaquetando Templates..."
dotnet pack src/ProjectTemplates/ProjectTemplates.csproj --configuration Release --no-restore --output ./nupkgs
if ($LASTEXITCODE -ne 0) { Write-Error "Pack fallido"; exit 1 }

- name: List generated packages
if: steps.extract_version.outputs.SKIP_WORKFLOW != 'true'
shell: pwsh
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -433,3 +433,6 @@ src/ProjectTemplates/**/*.ico

# Plan files
plan-*.md

# OpenCode .ignore file
.ignore
14 changes: 13 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ dotnet build src\EasyWindowsApplication\EasyWindowsApplication.csproj
dotnet run --project src\ProjectTemplates\SimpleEasyWinApp\SimpleEasyWinApp.csproj
```

### Plantillas (desarrollo)

Para reinstalar o desinstalar las plantillas sin recordar comandos, ejecuta el gestor interactivo:

```bash
.\devtools\install-templates.ps1
```

El menú permite reinstalar desde el repositorio (`src\ProjectTemplates`) o desde un paquete `.nupkg` local, desinstalar, y salir.

---

## Arquitectura de módulos
Expand Down Expand Up @@ -181,7 +191,7 @@ Todo trabajo (funcionalidad, ajuste, bugfix) comienza con un **issue** creado co
git checkout {número}-{slug}
```
4. **Trabaja y haz push** con commits en Conventional Commits (`feat:`, `fix:`, ...).
5. **Abre un Pull Request contra `develop`** e incluye en el body los marcadores de versión (`ver(core)` / `ver(gen)`) según la sección [CI/CD](#cicd).
5. **Abre un Pull Request contra `develop`** e incluye en el body los marcadores de versión (`ver(core)` / `ver(gen)` / `ver(template)`) según la sección [CI/CD](#cicd).
6. **Mergea a `develop`** → `dev-release.yml` publica el preview automáticamente. Los usuarios prueban y dan feedback, que se canaliza en nuevos issues.

Reglas:
Expand Down Expand Up @@ -217,9 +227,11 @@ Este repositorio publica paquetes NuGet automáticamente mediante GitHub Actions
```text
ver(core): 0.1.0-preview
ver(gen): 0.1.0-preview
ver(template): 0.1.0-preview
```
- `core` → paquete `RandAMediaLabGroup.EasyWindowsApplication`
- `gen` → paquete `RandAMediaLabGroup.EasyWindowsApplication.Generators`
- `template` → paquete `RandAMediaLabGroup.EasyWindowsApplication.Templates` (template pack `easywinapp` / `simpleeasywinapp`)
3. **Al *mergear*** a `develop`, el workflow `dev-release.yml` publica automáticamente el preview a NuGet y crea un *GitHub Release* con tag `v0.1.0-preview`.
4. **Para promover a estable**, abre un PR de `develop` → `main` con el **mismo** *body* (marcadores con `-preview`). Al *mergear*, `prod-release.yml` publica la versión estable y elimina el `-preview` del tag.

Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,15 @@ El framework incluye **dos plantillas** oficiales:
dotnet build src\EasyWindowsApplication.slnx
```

2. **Instala las plantillas localmente:**
2. **Instala las plantillas:**

**Opción A — Paquete NuGet (recomendado para usuarios):**
```bash
dotnet new install RandAMediaLabGroup.EasyWindowsApplication.Templates
```
El paquete incluye ambas plantillas (`easywinapp` y `simpleeasywinapp`) y los proyectos que genera dependen de los **paquetes NuGet** del framework (`RandAMediaLabGroup.EasyWindowsApplication` y `RandAMediaLabGroup.EasyWindowsApplication.Generators`) en su última versión publicada (preview o estable).

**Opción B — Desde la carpeta del repositorio (desarrollo):**
```bash
dotnet new install src\ProjectTemplates\EasyWinApp
dotnet new install src\ProjectTemplates\SimpleEasyWinApp
Expand All @@ -84,6 +92,8 @@ El framework incluye **dos plantillas** oficiales:

**Desintalaion de plantillas**
```bash
dotnet new uninstall RandAMediaLabGroup.EasyWindowsApplication.Templates

dotnet new uninstall src\ProjectTemplates\EasyWinApp
dotnet new uninstall src\ProjectTemplates\SimpleEasyWinApp

Expand All @@ -109,8 +119,7 @@ El framework incluye **dos plantillas** oficiales:

1. **Instala las plantillas** (una vez):
```bash
dotnet new install src\ProjectTemplates\EasyWinApp
dotnet new install src\ProjectTemplates\SimpleEasyWinApp
dotnet new install RandAMediaLabGroup.EasyWindowsApplication.Templates
```

2. **Archivo → Nuevo → Proyecto → Busca "Easy Win App" o "Simple Easy Win App" → Siguiente → Crear.**
Expand Down
Loading
Loading