changes #7
This file contains hidden or 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: Catalog Service | |
| on: | |
| push: | |
| paths: | |
| - catalog-service/** | |
| branches: | |
| - '**' | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| env: | |
| working-directory: ./catalog-service | |
| defaults: | |
| run: | |
| working-directory: ${{ env.working-directory }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Java 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| cache: 'maven' | |
| - name: Build with Maven | |
| run: ./mvnw -ntp verify | |
| - if: ${{github.ref == 'refs/heads/main'}} | |
| name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - if: ${{github.ref == 'refs/heads/main'}} | |
| name: Build and Push Docker Image | |
| run: | | |
| ./mvnw -ntp spring-boot:build-image -DSkipTests | |
| docker push ${{secrets.DOCKERHUB_USERNAME}}/bookstore-catalog-service:latest | |