Añadir .github/workflows/ci-cd.yml

This commit is contained in:
isidoro.nevares 2026-03-26 13:25:50 +01:00
parent 2457f987f6
commit 0826617dc4

32
.github/workflows/ci-cd.yml vendored Normal file
View File

@ -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