feat: configurar sistema de lanzamientos automáticos con IA local
Some checks failed
Release con IA Local / release-please (push) Failing after 21s
Some checks failed
Release con IA Local / release-please (push) Failing after 21s
This commit is contained in:
88
.gitea/workflows/release-please.yaml
Normal file
88
.gitea/workflows/release-please.yaml
Normal file
@@ -0,0 +1,88 @@
|
||||
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
|
||||
|
||||
# 1. Ejecutar Release Please (usa tu clon local)
|
||||
- name: Release Please
|
||||
id: release
|
||||
uses: https://repo.eldiaservicios.com/dmolinari/gitea-release-please-action@main
|
||||
with:
|
||||
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
|
||||
release-type: simple # Lo mantenemos simple para esta prueba
|
||||
|
||||
# 2. Si se creó un Release, llamar a tu PC (Ollama) para redactar notas épicas
|
||||
- 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;
|
||||
|
||||
// Obtener ID del release para actualizarlo
|
||||
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();
|
||||
|
||||
// Actualizar el body del 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); });
|
||||
'
|
||||
Reference in New Issue
Block a user