diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml new file mode 100644 index 0000000..c2d479a --- /dev/null +++ b/.github/workflows/ci-cd.yml @@ -0,0 +1,32 @@ +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + # Si necesitas JDK/Maven para tests previos + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 23 + + - name: Build Maven project + run: mvn clean package + + # Construir la imagen Docker usando el Dockerfile + - name: Build Docker image + run: docker build -t ghcr.io/${{ github.repository }}:latest . + + # Push a GHCR (GitHub Container Registry) + - name: Push Docker image + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push image + run: docker push ghcr.io/${{ github.repository }}:latest \ No newline at end of file