mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2026-01-23 20:01:12 +00:00
34 lines
789 B
YAML
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 }}
|