32 lines
875 B
YAML
32 lines
875 B
YAML
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 |