name: build-publish-docker on: push: branches: [ develop ] pull_request: jobs: build-and-push-docker-image: name: Build and Publish Docker image to DockerHub runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Prepare Release id: prepare-release uses: semantic-release/git with: args: --dry-run - name: Login to DockerHub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Build image run: | export VERSION=${{ steps.determine-version.outputs.next_version }} docker build -t meysamh66/booking-microservices-flight:$VERSION -f "${{ github.workspace }}/src/Services/Flight/Dockerfile" . docker build -t meysamh66/booking-microservices-identity:$VERSION -f "${{ github.workspace }}/src/Services/Identity/Dockerfile" . docker build -t meysamh66/booking-microservices-passenger:$VERSION -f "${{ github.workspace }}/src/Services/Passenger/Dockerfile" . docker build -t meysamh66/booking-microservices-booking:$VERSION -f "${{ github.workspace }}/src/Services/Booking/Dockerfile" . - name: Publish image run: | export VERSION=${{ steps.determine-version.outputs.next_version }} docker push meysamh66/booking-microservices-flight:$VERSION docker push meysamh66/booking-microservices-identity:$VERSION docker push meysamh66/booking-microservices-passenger:$VERSION docker push meysamh66/booking-microservices-booking:$VERSION