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 # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions - name: Semantic Release Publish id: semantic env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # because of using none default (conventionalcommits) `preset` for `semantic-release`, we should add dependency `conventional-changelog-conventionalcommits` # run: npx -p conventional-changelog-conventionalcommits -p @semantic-release/git -p @semantic-release/changelog -p @semantic-release/exec semantic-release - name: Semantic Release Outputs run: | echo ${{ steps.semantic.outputs.semantic_nextRelease_version }} echo ${{ steps.semantic.outputs.semantic_nextRelease_channel }} echo ${{ steps.semantic.outputs.semantic_nextRelease_gitTag }} echo ${{ steps.semantic.outputs.semantic_lastRelease_version }} echo ${{ steps.semantic.outputs.semantic_lastRelease_channel }} echo ${{ steps.semantic.outputs.semantic_lastRelease_gitTag }} # # - name: Get release tag # run: echo "::set-output name=tag::$(echo $GITHUB_REF)" # # - name: Print release tag # run: echo "The release tag is ${{ steps.get_tag.outputs.tag }}" - name: Login to DockerHub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Build image run: | docker build -t meysamh66/booking-microservices-flight:latest -f "${{ github.workspace }}/src/Services/Flight/Dockerfile" . docker build -t meysamh66/booking-microservices-identity:latest -f "${{ github.workspace }}/src/Services/Identity/Dockerfile" . docker build -t meysamh66/booking-microservices-passenger:latest -f "${{ github.workspace }}/src/Services/Passenger/Dockerfile" . docker build -t meysamh66/booking-microservices-booking:latest -f "${{ github.workspace }}/src/Services/Booking/Dockerfile" . - name: Publish image run: | docker push meysamh66/booking-microservices-flight:latest docker push meysamh66/booking-microservices-identity:latest docker push meysamh66/booking-microservices-passenger:latest docker push meysamh66/booking-microservices-booking:latest