-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (37 loc) · 1.04 KB
/
catalog-service.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Catalog Service
on:
push:
paths:
- catalog-service/**
branches:
- '**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
working-directory: ./catalog-service
DOCKER_IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/bookstore-catalog-service
defaults:
run:
working-directory: ${{ env.working-directory }}
steps:
- uses: actions/checkout@v4
- name: Setup Java 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Build with Maven
run: ./mvnw -ntp verify
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Publish Docker Image
run: |
./mvnw spring-boot:build-image -DskipTests
echo "Pushing the image $DOCKER_IMAGE_NAME to Docker Hub."
docker push $DOCKER_IMAGE_NAME