11# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
22# More GitHub Actions for Azure: https://github.com/Azure/actions
33
4- name : Build and deploy JAR app to Azure Web App - masterchefT2
4+ name : CI/CD - MasterChefAPI
55
66on :
77 push :
8+ branches :
9+ - develop
10+ - main
11+ pull_request :
812 branches :
913 - develop
1014 workflow_dispatch :
1115
1216jobs :
13- build :
17+ build-and-test :
1418 runs-on : ubuntu-latest
1519 permissions :
16- contents : read # This is required for actions/checkout
20+ contents : read
1721
1822 steps :
19- - uses : actions/checkout@v4
23+ - name : 📥 Checkout del repositorio
24+ uses : actions/checkout@v4
2025
21- - name : Set up Java version
26+ - name : ☕ Configurar Java 17
2227 uses : actions/setup-java@v4
2328 with :
2429 java-version : ' 17'
2530 distribution : ' microsoft'
2631
27- - name : Build with Maven
28- run : mvn clean install
32+ - name : ⚙️ Compilar y ejecutar pruebas
33+ run : mvn clean verify
2934
30- - name : Upload artifact for deployment job
35+ - name : 📦 Subir artefacto si es push a main
36+ if : github.ref == 'refs/heads/main'
3137 uses : actions/upload-artifact@v4
3238 with :
33- name : java-app
34- path : ' ${{ github.workspace }}/ target/*.jar'
39+ name : masterchef-api
40+ path : target/*.jar
3541
3642 deploy :
3743 runs-on : ubuntu-latest
38- needs : build
39- permissions :
40- id-token : write # This is required for requesting the JWT
41- contents : read # This is required for actions/checkout
42-
44+ needs : build-and-test
45+ if : github.ref == 'refs/heads/main' # Solo se ejecuta en push a main
46+ permissions :
47+ id-token : write
48+ contents : read
49+
4350 steps :
44- - name : Download artifact from build job
51+ - name : 📥 Descargar artefacto generado
4552 uses : actions/download-artifact@v4
4653 with :
47- name : java-app
48-
49- - name : Login to Azure
50- uses : azure/login@v2
51- with :
52- client-id : ${{ secrets.AZUREAPPSERVICE_CLIENTID_E3BBA8DC2C9849D1B0EFC1E10CE96DD0 }}
53- tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID_7C9E359957B94BC8950CA740807D8487 }}
54- subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_A24240666636424A8BBF6C81D16FE73E }}
55-
56- - name : Deploy to Azure Web App
57- id : deploy-to-webapp
54+ name : masterchef-api
55+
56+ - name : 🔐 Login a Azure
57+ uses : azure/login@v2
58+ with :
59+ client-id : ${{ secrets.AZUREAPPSERVICE_CLIENTID_E3BBA8DC2C9849D1B0EFC1E10CE96DD0 }}
60+ tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID_7C9E359957B94BC8950CA740807D8487 }}
61+ subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_A24240666636424A8BBF6C81D16FE73E }}
62+
63+ - name : 🚀 Desplegar en Azure Web App
5864 uses : azure/webapps-deploy@v3
5965 with :
60- app-name : ' masterchefT2'
61- slot-name : ' Production'
66+ app-name : ' masterchefT2'
6267 package : ' *.jar'
63-
0 commit comments