Skip to content

Commit a5d2da1

Browse files
author
Alfredo Tornero
committed
prueba 2810
1 parent 005b9c6 commit a5d2da1

File tree

1 file changed

+45
-2
lines changed

1 file changed

+45
-2
lines changed

.github/workflows/dotnet-ci.yml

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,32 @@ on:
1313
artifact_name:
1414
description: "Nombre del artefacto publicado"
1515
value: backend-artifact
16+
# nuevo: salida de versión
17+
version:
18+
description: "Versión generada automáticamente"
19+
value: ${{ jobs.build.outputs.version }}
20+
21+
permissions:
22+
contents: read
23+
actions: read
24+
25+
# 🔄 Evita ejecuciones paralelas en la misma rama
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.ref }}
28+
cancel-in-progress: true
1629

1730
jobs:
1831
build:
1932
runs-on: ubuntu-latest
33+
environment:
34+
name: production
35+
# url: https://nsf-backend-ga.azurewebsites.net # opcional
36+
strategy:
37+
matrix:
38+
dotnet: [ '8.0.x' ] # puedes agregar '9.0-preview' más adelante
39+
40+
outputs:
41+
version: ${{ steps.version.outputs.version }}
2042

2143
env:
2244
SOLUTION_PATH: ${{ inputs.solution }}
@@ -26,10 +48,10 @@ jobs:
2648
- name: 🧰 Checkout del código
2749
uses: actions/checkout@v5
2850

29-
- name: ⚙️ Configurar .NET 8
51+
- name: ⚙️ Configurar .NET ${{ matrix.dotnet }}
3052
uses: actions/setup-dotnet@v5
3153
with:
32-
dotnet-version: '8.0.x'
54+
dotnet-version: ${{ matrix.dotnet }}
3355

3456
- name: 💾 Cache de dependencias NuGet
3557
uses: actions/cache@v4
@@ -39,6 +61,13 @@ jobs:
3961
restore-keys: |
4062
${{ runner.os }}-nuget-
4163
64+
- name: 🏷️ Generar versión
65+
id: version
66+
run: |
67+
VERSION="1.0.${{ github.run_number }}"
68+
echo "version=$VERSION" >> $GITHUB_OUTPUT
69+
echo "🔖 Versión generada: $VERSION"
70+
4271
- name: 📦 Restaurar dependencias
4372
run: dotnet restore "$SOLUTION_PATH"
4473

@@ -70,3 +99,17 @@ jobs:
7099
name: backend-artifact
71100
path: ./publish
72101
retention-days: 5
102+
103+
- name: 📣 Notificar resultado en Teams
104+
if: always()
105+
uses: skitionek/notify-microsoft-teams@v2
106+
with:
107+
webhook_url: ${{ secrets.MS_TEAMS_WEBHOOK }}
108+
message: |
109+
${{ job.status == 'success' && '🟢 **Build exitosa**' || '🔴 **Build fallida**' }}
110+
**Workflow:** ${{ github.workflow }}
111+
**Versión:** ${{ steps.version.outputs.version }}
112+
**Branch:** ${{ github.ref_name }}
113+
**Actor:** ${{ github.actor }}
114+
**Ejecutado:** ${{ github.run_id }}
115+
theme_color: ${{ job.status == 'success' && '00FF00' || 'FF0000' }}

0 commit comments

Comments
 (0)