Update main.yml #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 -g @angular/cli | |
npm run build -- --configuration production --base-href="/new/" | |
nohup ng serve --proxy-config proxy.conf.json & | |
- name: Run Spring Boot tests | |
run: | | |
cd ./backend | |
mvn test -Dtest=BofApplicationTest.java | |
- 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 | |