diff --git a/.github/workflows/basic-workflow.yml b/.github/workflows/basic-workflow.yml
index 04785de..77696f1 100644
--- a/.github/workflows/basic-workflow.yml
+++ b/.github/workflows/basic-workflow.yml
@@ -2,16 +2,30 @@ name: Continuous integration example
on:
push:
+ paths:
+ - src/**
+ - pom.xml
jobs:
- test:
+ publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - name: Set up JDK 21
+ - name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- - run: mvn test
+ - name: Run tests
+ run: mvn test
+ - name: Generate tag
+ run: echo "tag=$(mvn -q help:evaluate -Dexpression=project.version -DforceStdout)" >> $GITHUB_OUTPUT
+ id: project
+
+ - name: Generate Docker image
+ run: mvn spring-boot:build-image -DskipTests -Dspring-boot.build-image.imageName=${{ secrets.DOCKERHUB_USERNAME }}/calculadora:${{ steps.project.outputs.tag }}
+ - name: Login to DockerHub
+ run: docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" -p "${{ secrets.DOCKERHUB_TOKEN }}"
+ - name: Push image to DockerHub
+ run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/calculadora:0.0.1-SNAPSHOT
diff --git a/README.md b/README.md
index a0fa09a..0e22bcc 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@
# Ejemplo de Integración Continua con GitHub Actions
Este proyecto ofrece una Calculadora hecha en Java
+Cambio 2
diff --git a/pom.xml b/pom.xml
index 105499c..58fe361 100755
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
es.codeurjc.test
calculadora
- 0.0.1-SNAPSHOT
+ 0.0.1
jar