spring-petclinic/.github/workflows/build.yml
2025-02-11 00:58:52 -06:00

34 lines
789 B
YAML

name: Build and Deploy
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: ./mvnw package -B
- name: Build Docker Image
run: docker build -t petclinic:${{ github.sha }} .
- name: Test
run: ./mvnw test
- name: Login to dockerhub
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "{{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
- name: Push Image to Docker Hub
run: docker push ybandala/petclinic:${{ github.sha }}