Skip to content

Update main.yml

Update main.yml #19

Workflow file for this run

name: Java CI with Maven
on:
workflow_dispatch:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Build and Run Spring Boot Backend
run: |
cd ./backend
mvn clean package -DskipTests
nohup java -jar target/*.jar &
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20.17.0
# Build y ejecución del Frontend (sin tests)
- name: Build and Run Angular Frontend
run: |
cd ./frontend
npm ci
npm install
npm run build --prod
nohup npx http-server ./dist/[frontend] -p 4200 &
- name: Run Spring Boot tests
run: |
cd ./backend
mvn test
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/java_app:2.0 -f docker/Dockerfile .
docker push ${{ secrets.DOCKER_USERNAME }}/java_app:2.0