Compare commits
28 Commits
bd6ea393f5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e483dc02ab | ||
| d7d7b4b5cd | |||
| e17f19dd20 | |||
| fb0082a45b | |||
| de7937b421 | |||
|
|
b1dd0bca9f | ||
| 489b86f821 | |||
| 3c7251f49f | |||
| fc1c381284 | |||
| 78eced728b | |||
| 70598a6a87 | |||
| 73bb85f71c | |||
| 6cfeeb7142 | |||
| ad470afb6f | |||
| 3b6f7175f8 | |||
| 5ae0ad2af6 | |||
| 62a10af833 | |||
| 7856147cfa | |||
| 5284d27ae2 | |||
| 8b2fbfa7c6 | |||
| bcc37d7aa7 | |||
| 7d563331e3 | |||
| e87dae1fb5 | |||
| 27c5af2f27 | |||
| 05fadd759a | |||
| 6ff01a803c | |||
| 0c758b33b2 | |||
| 06432100b2 |
10
.dockerignore
Normal file
10
.dockerignore
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
**/.dockerignore
|
||||||
|
**/.env
|
||||||
|
**/bin
|
||||||
|
**/obj
|
||||||
|
**/.vs
|
||||||
|
**/.vscode
|
||||||
|
**/ignore
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
Dockerfile
|
||||||
129
.gitea/workflows/semantic-release.yaml
Normal file
129
.gitea/workflows/semantic-release.yaml
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
name: CI/CD Semantic Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout del código
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Preparar entorno Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '18'
|
||||||
|
|
||||||
|
- name: Instalar Semantic Release y Plugins
|
||||||
|
run: npm install -D semantic-release @saithodev/semantic-release-gitea @semantic-release/changelog @semantic-release/git @semantic-release/exec
|
||||||
|
|
||||||
|
- name: Generar configuración de Release
|
||||||
|
env:
|
||||||
|
# Inyectamos el token aquí para poder construir la URL de Git
|
||||||
|
GITEA_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
|
||||||
|
run: |
|
||||||
|
# Construimos la URL de Git con el token incrustado
|
||||||
|
REPO_URL_WITH_TOKEN="https://gitea_actions:${GITEA_TOKEN}@repo.eldiaservicios.com/${{ github.repository }}.git"
|
||||||
|
|
||||||
|
cat << EOF > .releaserc.json
|
||||||
|
{
|
||||||
|
"branches": ["main"],
|
||||||
|
"repositoryUrl": "${REPO_URL_WITH_TOKEN}",
|
||||||
|
"plugins":[
|
||||||
|
"@semantic-release/commit-analyzer",
|
||||||
|
"@semantic-release/release-notes-generator",
|
||||||
|
"@semantic-release/changelog",
|
||||||
|
[
|
||||||
|
"@semantic-release/git",
|
||||||
|
{
|
||||||
|
"assets": ["CHANGELOG.md"],
|
||||||
|
"message": "chore(release): \${nextRelease.version} [skip ci]\n\n\${nextRelease.notes}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"@saithodev/semantic-release-gitea",
|
||||||
|
{
|
||||||
|
"giteaUrl": "https://repo.eldiaservicios.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"@semantic-release/exec",
|
||||||
|
{
|
||||||
|
"successCmd": "echo 'RELEASE_CREATED=true' >> \$GITHUB_ENV && echo 'TAG_NAME=\${nextRelease.gitTag}' >> \$GITHUB_ENV"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Ejecutar Semantic Release
|
||||||
|
env:
|
||||||
|
# Este GITEA_TOKEN es para el plugin de Gitea (crear el release)
|
||||||
|
GITEA_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
|
||||||
|
run: npx semantic-release
|
||||||
|
|
||||||
|
- name: 🤖 Generar notas con IA Local (Ollama)
|
||||||
|
if: env.RELEASE_CREATED == 'true'
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
TAG_NAME: ${{ env.TAG_NAME }}
|
||||||
|
run: |
|
||||||
|
node -e '
|
||||||
|
async function run() {
|
||||||
|
const giteaUrl = "https://repo.eldiaservicios.com/api/v1";
|
||||||
|
const ollamaUrl = "http://192.168.10.78:11434/api/generate";
|
||||||
|
|
||||||
|
console.log(`Obteniendo la release ${process.env.TAG_NAME} de Gitea...`);
|
||||||
|
const relRes = await fetch(`${giteaUrl}/repos/${process.env.REPO}/releases/tags/${process.env.TAG_NAME}`, {
|
||||||
|
headers: { "Authorization": `token ${process.env.GITEA_TOKEN}` }
|
||||||
|
});
|
||||||
|
const relData = await relRes.json();
|
||||||
|
const rawNotes = relData.body;
|
||||||
|
|
||||||
|
const prompt = `Eres un redactor experto de notas de lanzamiento (release notes).
|
||||||
|
Tu misión es transformar una lista técnica de commits en un anuncio acotado, profesional y descriptivo.
|
||||||
|
|
||||||
|
Instrucciones:
|
||||||
|
- Usa Markdown elegante.
|
||||||
|
- Usa emojis que tengan sentido.
|
||||||
|
- Agrupa por secciones (Ej: 🚀 Novedades, 🛠️ Mejoras Técnicas).
|
||||||
|
- El tono debe ser entusiasta pero profesional.
|
||||||
|
- Escribe exclusivamente en español.
|
||||||
|
|
||||||
|
Lista de cambios original:
|
||||||
|
${rawNotes}`;
|
||||||
|
|
||||||
|
console.log("Conectando con Ollama en tu PC para generar notas...");
|
||||||
|
const aiRes = await fetch(ollamaUrl, {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({
|
||||||
|
model: "llama3.1",
|
||||||
|
prompt: prompt,
|
||||||
|
stream: false
|
||||||
|
})
|
||||||
|
});
|
||||||
|
const aiData = await aiRes.json();
|
||||||
|
const aiNotes = aiData.response;
|
||||||
|
|
||||||
|
console.log("Actualizando la Release en Gitea...");
|
||||||
|
await fetch(`${giteaUrl}/repos/${process.env.REPO}/releases/${relData.id}`, {
|
||||||
|
method: "PATCH",
|
||||||
|
headers: {
|
||||||
|
"Authorization": `token ${process.env.GITEA_TOKEN}`,
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ body: aiNotes })
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("¡Release Notes actualizadas por la IA!");
|
||||||
|
}
|
||||||
|
run().catch(err => { console.error(err); process.exit(1); });
|
||||||
|
'
|
||||||
476
.gitignore
vendored
476
.gitignore
vendored
@@ -1,14 +1,482 @@
|
|||||||
# ---> VisualStudioCode
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
##
|
||||||
|
## Get latest from `dotnet new gitignore`
|
||||||
|
|
||||||
|
# dotenv files
|
||||||
|
.env
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.rsuser
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Mono auto generated files
|
||||||
|
mono_crash.*
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
[Ww][Ii][Nn]32/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# Visual Studio 2017 auto generated files
|
||||||
|
Generated\ Files/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUnit
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
nunit-*.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# Benchmark Results
|
||||||
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
|
# .NET
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
# Tye
|
||||||
|
.tye/
|
||||||
|
|
||||||
|
# ASP.NET Scaffolding
|
||||||
|
ScaffoldingReadMe.txt
|
||||||
|
|
||||||
|
# StyleCop
|
||||||
|
StyleCopReport.xml
|
||||||
|
|
||||||
|
# Files built by Visual Studio
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_h.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.iobj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
# but not Directory.Build.rsp, as it configures directory-level build defaults
|
||||||
|
!Directory.Build.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
|
*.log
|
||||||
|
*.tlog
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# Visual Studio Trace Files
|
||||||
|
*.e2e
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# Coverlet is a free, cross platform Code Coverage Tool
|
||||||
|
coverage*.json
|
||||||
|
coverage*.xml
|
||||||
|
coverage*.info
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# NuGet Symbol Packages
|
||||||
|
*.snupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/[Pp]ackages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/[Pp]ackages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/[Pp]ackages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
*.appx
|
||||||
|
*.appxbundle
|
||||||
|
*.appxupload
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!?*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Including strong name files can present a security risk
|
||||||
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
|
#*.snk
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
*.rptproj.rsuser
|
||||||
|
*- [Bb]ackup.rdl
|
||||||
|
*- [Bb]ackup ([0-9]).rdl
|
||||||
|
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||||
|
*.vbp
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||||
|
*.dsw
|
||||||
|
*.dsp
|
||||||
|
|
||||||
|
# Visual Studio 6 technical files
|
||||||
|
*.ncb
|
||||||
|
*.aps
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# CodeRush personal settings
|
||||||
|
.cr/personal
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
# tools/**
|
||||||
|
# !tools/packages.config
|
||||||
|
|
||||||
|
# Tabs Studio
|
||||||
|
*.tss
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
||||||
|
# OpenCover UI analysis results
|
||||||
|
OpenCover/
|
||||||
|
|
||||||
|
# Azure Stream Analytics local run output
|
||||||
|
ASALocalRun/
|
||||||
|
|
||||||
|
# MSBuild Binary and Structured Log
|
||||||
|
*.binlog
|
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file
|
||||||
|
*.nvuser
|
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
|
.mfractor/
|
||||||
|
|
||||||
|
# Local History for Visual Studio
|
||||||
|
.localhistory/
|
||||||
|
|
||||||
|
# Visual Studio History (VSHistory) files
|
||||||
|
.vshistory/
|
||||||
|
|
||||||
|
# BeatPulse healthcheck temp database
|
||||||
|
healthchecksdb
|
||||||
|
|
||||||
|
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||||
|
MigrationBackup/
|
||||||
|
|
||||||
|
# Ionide (cross platform F# VS Code tools) working folder
|
||||||
|
.ionide/
|
||||||
|
|
||||||
|
# Fody - auto-generated XML schema
|
||||||
|
FodyWeavers.xsd
|
||||||
|
|
||||||
|
# VS Code files for those working on multiple tools
|
||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode/settings.json
|
!.vscode/settings.json
|
||||||
!.vscode/tasks.json
|
!.vscode/tasks.json
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
!.vscode/*.code-snippets
|
*.code-workspace
|
||||||
|
|
||||||
# Local History for Visual Studio Code
|
# Local History for Visual Studio Code
|
||||||
.history/
|
.history/
|
||||||
|
|
||||||
# Built Visual Studio Code Extensions
|
# Windows Installer files from build outputs
|
||||||
*.vsix
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msix
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# JetBrains Rider
|
||||||
|
*.sln.iml
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
##
|
||||||
|
## Visual studio for Mac
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
# globs
|
||||||
|
Makefile.in
|
||||||
|
*.userprefs
|
||||||
|
*.usertasks
|
||||||
|
config.make
|
||||||
|
config.status
|
||||||
|
aclocal.m4
|
||||||
|
install-sh
|
||||||
|
autom4te.cache/
|
||||||
|
*.tar.gz
|
||||||
|
tarballs/
|
||||||
|
test-results/
|
||||||
|
|
||||||
|
# content below from: https://github.com/github/gitignore/blob/main/Global/macOS.gitignore
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
# content below from: https://github.com/github/gitignore/blob/main/Global/Windows.gitignore
|
||||||
|
# Windows thumbnail cache files
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
ehthumbs_vista.db
|
||||||
|
|
||||||
|
# Dump file
|
||||||
|
*.stackdump
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
[Dd]esktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msix
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
# Vim temporary swap files
|
||||||
|
*.swp
|
||||||
|
|||||||
16
ApiVersioningDemo.Api/ApiVersioningDemo.Api.csproj
Normal file
16
ApiVersioningDemo.Api/ApiVersioningDemo.Api.csproj
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Asp.Versioning.Http" Version="8.1.1" />
|
||||||
|
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.1" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.3" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.1.4" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
6
ApiVersioningDemo.Api/ApiVersioningDemo.Api.http
Normal file
6
ApiVersioningDemo.Api/ApiVersioningDemo.Api.http
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
@ApiVersioningDemo.Api_HostAddress = http://localhost:5044
|
||||||
|
|
||||||
|
GET {{ApiVersioningDemo.Api_HostAddress}}/weatherforecast/
|
||||||
|
Accept: application/json
|
||||||
|
|
||||||
|
###
|
||||||
42
ApiVersioningDemo.Api/ConfigureSwaggerOptions.cs
Normal file
42
ApiVersioningDemo.Api/ConfigureSwaggerOptions.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using Asp.Versioning.ApiExplorer;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Microsoft.OpenApi;
|
||||||
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||||
|
|
||||||
|
namespace ApiVersioningDemo.Api;
|
||||||
|
|
||||||
|
public class ConfigureSwaggerOptions : IConfigureOptions<SwaggerGenOptions>
|
||||||
|
{
|
||||||
|
private readonly IApiVersionDescriptionProvider _provider;
|
||||||
|
|
||||||
|
public ConfigureSwaggerOptions(IApiVersionDescriptionProvider provider)
|
||||||
|
{
|
||||||
|
_provider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Configure(SwaggerGenOptions options)
|
||||||
|
{
|
||||||
|
// Por cada versión de API detectada, crea un documento Swagger
|
||||||
|
foreach (var description in _provider.ApiVersionDescriptions)
|
||||||
|
{
|
||||||
|
options.SwaggerDoc(description.GroupName, CreateInfoForApiVersion(description));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static OpenApiInfo CreateInfoForApiVersion(ApiVersionDescription description)
|
||||||
|
{
|
||||||
|
var info = new OpenApiInfo()
|
||||||
|
{
|
||||||
|
Title = "Mi API Versionada",
|
||||||
|
Version = description.ApiVersion.ToString(),
|
||||||
|
Description = "Ejemplo de API REST con versionado en .NET"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (description.IsDeprecated)
|
||||||
|
{
|
||||||
|
info.Description += " (Esta versión está obsoleta)";
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// ApiVersioningDemo.Api/Controllers/WeatherForecastController.cs
|
||||||
|
using Asp.Versioning;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace ApiVersioningDemo.Api.Controllers;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
[ApiVersion("1.0")] // 1. Le decimos explícitamente que este es el controlador de la v1
|
||||||
|
[Route("api/v{version:apiVersion}/[controller]")] // 2. Modificamos la ruta para obligar a usar "api/v1/..."
|
||||||
|
public class WeatherForecastController : ControllerBase
|
||||||
|
{
|
||||||
|
private static readonly string[] Summaries = [
|
||||||
|
"Helado", "Frío", "Fresco", "Templado", "Cálido", "Caluroso", "Sofocante", "SuperScorching"
|
||||||
|
];
|
||||||
|
|
||||||
|
[HttpGet(Name = "GetWeatherForecast")]
|
||||||
|
public IEnumerable<WeatherForecast> Get()
|
||||||
|
{
|
||||||
|
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||||
|
{
|
||||||
|
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||||
|
TemperatureC = Random.Shared.Next(-20, 55),
|
||||||
|
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||||
|
})
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
// ApiVersioningDemo.Api/Controllers/WeatherForecastV2Controller.cs
|
||||||
|
using Asp.Versioning;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace ApiVersioningDemo.Api.Controllers;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
[ApiVersion("2.0")] // 1. ¡Esta es la clave! Le decimos que es la versión 2.
|
||||||
|
[Route("api/v{version:apiVersion}/WeatherForecast")] // 2. Forzamos la ruta para que responda a la v2
|
||||||
|
public class WeatherForecastV2Controller : ControllerBase
|
||||||
|
{
|
||||||
|
private static readonly string[] Summaries = [
|
||||||
|
"Helado", "Frío", "Fresco", "Templado", "Cálido", "Caluroso", "Sofocante", "SuperScorching"
|
||||||
|
];
|
||||||
|
|
||||||
|
[HttpGet(Name = "GetWeatherForecastV2")]
|
||||||
|
// CAMBIO 1: Cambiamos IActionResult por ActionResult<TipoConcreto>
|
||||||
|
public ActionResult<WeatherForecastResponseV2> Get()
|
||||||
|
{
|
||||||
|
var forecast = Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||||
|
{
|
||||||
|
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||||
|
TemperatureC = Random.Shared.Next(-20, 55),
|
||||||
|
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||||
|
}).ToArray();
|
||||||
|
|
||||||
|
// CAMBIO 2: Devolvemos el record tipado en lugar del anónimo
|
||||||
|
var response = new WeatherForecastResponseV2("Buenos Aires", forecast);
|
||||||
|
|
||||||
|
return Ok(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Definición fuerte de la respuesta para que Swagger la entienda
|
||||||
|
public record WeatherForecastResponseV2(string Ciudad, IEnumerable<WeatherForecast> Pronosticos);
|
||||||
52
ApiVersioningDemo.Api/Program.cs
Normal file
52
ApiVersioningDemo.Api/Program.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using ApiVersioningDemo.Api;
|
||||||
|
using Asp.Versioning;
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
// 1. Configuración de Versionado (YA LO TENÍAS)
|
||||||
|
builder.Services.AddApiVersioning(options =>
|
||||||
|
{
|
||||||
|
options.DefaultApiVersion = new ApiVersion(1, 0);
|
||||||
|
options.AssumeDefaultVersionWhenUnspecified = true;
|
||||||
|
options.ReportApiVersions = true;
|
||||||
|
})
|
||||||
|
.AddMvc()
|
||||||
|
.AddApiExplorer(options =>
|
||||||
|
{
|
||||||
|
// IMPORTANTE: El formato "'v'VVV" hace que la versión se llame "v1", "v2", etc.
|
||||||
|
options.GroupNameFormat = "'v'VVV";
|
||||||
|
options.SubstituteApiVersionInUrl = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2. Configuración de Swagger
|
||||||
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
builder.Services.AddSwaggerGen();
|
||||||
|
|
||||||
|
// Esta lógica crea un documento Swagger por cada versión descubierta automáticamente
|
||||||
|
builder.Services.ConfigureOptions<ConfigureSwaggerOptions>();
|
||||||
|
|
||||||
|
builder.Services.AddControllers();
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
// 3. Activar la Interfaz Gráfica
|
||||||
|
if (app.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseSwagger();
|
||||||
|
app.UseSwaggerUI(options =>
|
||||||
|
{
|
||||||
|
// Genera un endpoint JSON por cada versión que exista en la API
|
||||||
|
var descriptions = app.DescribeApiVersions();
|
||||||
|
foreach (var description in descriptions)
|
||||||
|
{
|
||||||
|
var url = $"/swagger/{description.GroupName}/swagger.json";
|
||||||
|
var name = description.GroupName.ToUpperInvariant();
|
||||||
|
options.SwaggerEndpoint(url, name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseHttpsRedirection();
|
||||||
|
app.UseAuthorization();
|
||||||
|
app.MapControllers();
|
||||||
|
app.Run();
|
||||||
23
ApiVersioningDemo.Api/Properties/launchSettings.json
Normal file
23
ApiVersioningDemo.Api/Properties/launchSettings.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||||
|
"profiles": {
|
||||||
|
"http": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": false,
|
||||||
|
"applicationUrl": "http://localhost:5044",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"https": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": false,
|
||||||
|
"applicationUrl": "https://localhost:7105;http://localhost:5044",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
ApiVersioningDemo.Api/WeatherForecast.cs
Normal file
12
ApiVersioningDemo.Api/WeatherForecast.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace ApiVersioningDemo.Api;
|
||||||
|
|
||||||
|
public class WeatherForecast
|
||||||
|
{
|
||||||
|
public DateOnly Date { get; set; }
|
||||||
|
|
||||||
|
public int TemperatureC { get; set; }
|
||||||
|
|
||||||
|
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||||
|
|
||||||
|
public string? Summary { get; set; }
|
||||||
|
}
|
||||||
8
ApiVersioningDemo.Api/appsettings.Development.json
Normal file
8
ApiVersioningDemo.Api/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
ApiVersioningDemo.Api/appsettings.json
Normal file
9
ApiVersioningDemo.Api/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
||||||
3
ApiVersioningDemo.slnx
Normal file
3
ApiVersioningDemo.slnx
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<Solution>
|
||||||
|
<Project Path="ApiVersioningDemo.Api/ApiVersioningDemo.Api.csproj" />
|
||||||
|
</Solution>
|
||||||
24
CHANGELOG.md
Normal file
24
CHANGELOG.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# 1.0.0 (2026-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* configurar repositoryUrl para git push en semantic-release ([d7d7b4b](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/d7d7b4b5cd2717c788bb81d77d2c4852774c2db9))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* agregar clima extremo SuperScorching ([7d56333](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/7d563331e3c8e8ed986aa742b09ba9c3f89cfbbd))
|
||||||
|
* agregar docker-compose.yml apuntado a Gitea ([6cfeeb7](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/6cfeeb714271a03c652e59291d2122bb151ca2f7))
|
||||||
|
* agregar endpoint v2 con ciudad. Closes [#7](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/issues/7) ([5284d27](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/5284d27ae291776442667bec594f20b64d9269ef))
|
||||||
|
* agregar soporte docker y publicar en gitea packages. Closes [#11](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/issues/11) ([3b6f717](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/3b6f7175f8793378c3d19039abe987045e7fc9a7))
|
||||||
|
* configurar sistema de lanzamientos automáticos con IA local ([73bb85f](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/73bb85f71cabdacaf5cd1fd25f1549bd60df9c2c))
|
||||||
|
* configurar swagger con soporte para multiples versiones v1 y v2 ([62a10af](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/62a10af8330cf59c8d33fac094ccc3d0735aa7e3))
|
||||||
|
* correccion de red y configuracion de lanzamientos ([78eced7](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/78eced728b038fa1f4f5578f60f9a1edee62fda1))
|
||||||
|
* forzar indexacion de commits de gitea ([489b86f](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/489b86f8218ff8cd3d5ef857ffd4673a5ed8c733))
|
||||||
|
* implementar script de rescate para pull requests y corregir entorno ([3c7251f](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/3c7251f49f79a1fc2d74144a1873ad8429991b20))
|
||||||
|
* implementar versionado de API por URL v1. Closes [#3](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/issues/3) ([6ff01a8](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/6ff01a803c26e1dd3d47eb718ed22dd6538deb89))
|
||||||
|
* inicializar proyecto base web api. Cierra [#1](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/issues/1) ([0643210](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/06432100b2b36477375d98044c47fb8bda99115c))
|
||||||
|
* migrar pipeline a semantic release con IA ([fb0082a](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/fb0082a45b175dd6b157dcee381101e8bf56c43d))
|
||||||
|
* traducir climas al español ([27c5af2](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/27c5af2f27cbf8097e3a0c1f2cc7832542801caa))
|
||||||
|
* usar token personal para evitar error 500 en gitea api ([fc1c381](https://repo.eldiaservicios.com/dmolinari/ApiVersioningDemo/commit/fc1c3812840cb568a34755fa49c125810a7ad07a))
|
||||||
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# ETAPA 1: BUILD
|
||||||
|
# Usamos la imagen del SDK para compilar el código
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
# Copiamos primero los archivos de proyecto para aprovechar la caché de Docker
|
||||||
|
COPY ["ApiVersioningDemo.Api/ApiVersioningDemo.Api.csproj", "ApiVersioningDemo.Api/"]
|
||||||
|
RUN dotnet restore "ApiVersioningDemo.Api/ApiVersioningDemo.Api.csproj"
|
||||||
|
|
||||||
|
# Copiamos todo el resto del código
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/ApiVersioningDemo.Api"
|
||||||
|
RUN dotnet build "ApiVersioningDemo.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
|
# Publicamos la aplicación (genera los .dll finales)
|
||||||
|
FROM build AS publish
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
RUN dotnet publish "ApiVersioningDemo.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
|
# ETAPA 2: RUNTIME
|
||||||
|
# Usamos la imagen ligera de ASP.NET Core solo para ejecutar
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final
|
||||||
|
WORKDIR /app
|
||||||
|
EXPOSE 8080
|
||||||
|
EXPOSE 8081
|
||||||
|
|
||||||
|
# Copiamos los archivos compilados de la etapa anterior
|
||||||
|
COPY --from=publish /app/publish .
|
||||||
|
|
||||||
|
# Definimos el punto de entrada
|
||||||
|
ENTRYPOINT ["dotnet", "ApiVersioningDemo.Api.dll"]
|
||||||
11
docker-compose.yml
Normal file
11
docker-compose.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
services:
|
||||||
|
api-versionada:
|
||||||
|
# Apuntamos a la imagen de Gitea Packages
|
||||||
|
image: repo.eldiaservicios.com/dmolinari/apiversioningdemo:v1
|
||||||
|
container_name: mi-api-demo
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
environment:
|
||||||
|
# Forzamos el entorno de desarrollo para poder ver Swagger
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Development
|
||||||
|
restart: unless-stopped
|
||||||
Reference in New Issue
Block a user