build: add test step to docker hub publish #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Hub Publish | |
on: | |
push: | |
branches: [ "master" ] | |
paths-ignore: | |
- 'database/**' | |
- 'documentation/**' | |
- 'README.md' | |
- '.insomnium' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
service: [ eureka-service, api-gateway, user-service, auth-service, inventory-service, reviews-service, order-service, notification-service ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Build and Test ${{ matrix.service }} | |
run: | | |
mvn -B package --file ${{ matrix.service }}/pom.xml | |
publish: | |
needs: test | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
service: [ eureka-service, api-gateway, user-service, auth-service, inventory-service, reviews-service, order-service, notification-service ] | |
platforms: [ linux/arm64, linux/amd64 ] | |
steps: | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: 8160202 | |
password: ${{ secrets.DOCKER_HUB_PW }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: "{{defaultContext}}:${{ matrix.service }}" | |
push: true | |
tags: 8160202/${{ matrix.service }}:latest | |
platforms: ${{ matrix.platforms }} | |