Compare commits
6 Commits
489b86f821
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e483dc02ab | ||
| d7d7b4b5cd | |||
| e17f19dd20 | |||
| fb0082a45b | |||
| de7937b421 | |||
|
|
b1dd0bca9f |
@@ -1,133 +0,0 @@
|
|||||||
name: Release con IA Local
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release-please:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0 # Descarga todo el historial para evitar errores de Gitea
|
|
||||||
|
|
||||||
- name: Release Please
|
|
||||||
id: release
|
|
||||||
uses: https://repo.eldiaservicios.com/dmolinari/gitea-release-please-action@main
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
|
|
||||||
release-type: simple
|
|
||||||
|
|
||||||
# NUEVO PASO: Despierta a Gitea para que reconozca los cambios
|
|
||||||
- name: Forzar actualización de rama en Gitea
|
|
||||||
if: failure()
|
|
||||||
run: |
|
|
||||||
echo "Despertando a Gitea para que indexe los cambios..."
|
|
||||||
git config --global user.name "Gitea Actions"
|
|
||||||
git config --global user.email "actions@gitea.local"
|
|
||||||
git fetch origin release-please--branches--main
|
|
||||||
git checkout release-please--branches--main
|
|
||||||
git commit --allow-empty -m "chore: forzar indexacion visual en Gitea"
|
|
||||||
git remote set-url origin https://x-access-token:${{ secrets.RELEASE_PLEASE_TOKEN }}@repo.eldiaservicios.com/${{ github.repository }}.git
|
|
||||||
git push origin release-please--branches--main
|
|
||||||
|
|
||||||
- name: Rescate - Crear Pull Request Manualmente
|
|
||||||
if: failure()
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
|
|
||||||
REPO: ${{ github.repository }}
|
|
||||||
run: |
|
|
||||||
node -e '
|
|
||||||
async function run() {
|
|
||||||
const giteaUrl = "https://repo.eldiaservicios.com/api/v1";
|
|
||||||
const prRes = await fetch(`${giteaUrl}/repos/${process.env.REPO}/pulls`, {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Authorization": `token ${process.env.GITEA_TOKEN}`,
|
|
||||||
"Content-Type": "application/json"
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
head: "release-please--branches--main",
|
|
||||||
base: "main",
|
|
||||||
title: "chore(main): release",
|
|
||||||
body: "🤖 Pull Request generado automáticamente por el sistema de CI/CD. (Rescatado por script)"
|
|
||||||
})
|
|
||||||
});
|
|
||||||
if (prRes.ok) {
|
|
||||||
console.log("✅ ¡Pull Request creado exitosamente!");
|
|
||||||
} else {
|
|
||||||
console.log("❌ Falló el rescate:", await prRes.text());
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
run().catch(err => { console.error(err); process.exit(1); });
|
|
||||||
'
|
|
||||||
|
|
||||||
- name: Generar notas con IA Local
|
|
||||||
if: ${{ steps.release.outputs.release_created }}
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
|
|
||||||
REPO: ${{ github.repository }}
|
|
||||||
TAG_NAME: ${{ steps.release.outputs.tag_name }}
|
|
||||||
RAW_NOTES: ${{ steps.release.outputs.body }}
|
|
||||||
run: |
|
|
||||||
node -e '
|
|
||||||
async function run() {
|
|
||||||
const giteaUrl = "https://repo.eldiaservicios.com/api/v1";
|
|
||||||
const ollamaUrl = "http://192.168.10.78:11434/api/generate";
|
|
||||||
|
|
||||||
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:
|
|
||||||
${process.env.RAW_NOTES}`;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
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();
|
|
||||||
|
|
||||||
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); });
|
|
||||||
'
|
|
||||||
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); });
|
||||||
|
'
|
||||||
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))
|
||||||
Reference in New Issue
Block a user