Release Java version

name: Release Java version
on:
  push:
    branches: "quarkus-release/**"
jobs:
  build-java-kafka:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 1.17
        uses: actions/setup-java@v1
        with:
          java-version: 1.17
      - name: Install zip
        uses: montudor/action-zip@v1
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v2
        with:
          aws-access-key-id: ${{ secrets.ECR_ID }}
          aws-secret-access-key: ${{ secrets.ECR_TOKEN }}
          aws-region: us-east-1
      - name: Login to Amazon ECR
        id: login-ecr
        uses: aws-actions/amazon-ecr-login@v1
        with:
          registry-type: public
      - name: Build testserver
        run: |
          cd testserver
          docker build -t testserver .
      - name: Get release number
        id: get-id
        run: |
          id=$(echo ${{github.ref_name}} | cut -d/ -f2)
          echo "::set-output name=id::$id"
      - name: build-java-with-kafka
        run: |
          mvn clean package -DskipTests -Dkafka -Pkafka -Ddocker -Ddocker-tag=java-kafka-${{steps.get-id.outputs.id}} -Dos=java -Dquarkus.profile=kafka
      - name: docker tag
        run: |
          docker tag scorpiobroker/at-context-server:java-kafka-${{steps.get-id.outputs.id}} scorpiobroker/at-context-server:java-kafka-latest
          docker tag scorpiobroker/history-entity-manager:java-kafka-${{steps.get-id.outputs.id}} scorpiobroker/history-entity-manager:java-kafka-latest
          docker tag scorpiobroker/history-query-manager:java-kafka-${{steps.get-id.outputs.id}} scorpiobroker/history-query-manager:java-kafka-latest
          docker tag scorpiobroker/registry-subscription-manager:java-kafka-${{steps.get-id.outputs.id}} scorpiobroker/registry-subscription-manager:java-kafka-latest
          docker tag scorpiobroker/registry-manager:java-kafka-${{steps.get-id.outputs.id}} scorpiobroker/registry-manager:java-kafka-latest
          docker tag scorpiobroker/subscription-manager:java-kafka-${{steps.get-id.outputs.id}} scorpiobroker/subscription-manager:java-kafka-latest
          docker tag scorpiobroker/query-manager:java-kafka-${{steps.get-id.outputs.id}} scorpiobroker/query-manager:java-kafka-latest
          docker tag scorpiobroker/entity-manager:java-kafka-${{steps.get-id.outputs.id}} scorpiobroker/entity-manager:java-kafka-latest
          docker tag scorpiobroker/all-in-one-runner:java-kafka-${{steps.get-id.outputs.id}} scorpiobroker/all-in-one-runner:java-kafka-latest
          docker tag scorpiobroker/at-context-server:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-kafka-latest
          docker tag scorpiobroker/history-entity-manager:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-kafka-latest
          docker tag scorpiobroker/history-query-manager:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-kafka-latest
          docker tag scorpiobroker/registry-subscription-manager:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-kafka-latest
          docker tag scorpiobroker/registry-manager:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-kafka-latest
          docker tag scorpiobroker/subscription-manager:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-kafka-latest
          docker tag scorpiobroker/query-manager:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-kafka-latest
          docker tag scorpiobroker/entity-manager:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-kafka-latest
          docker tag scorpiobroker/all-in-one-runner:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-kafka-latest
          docker tag scorpiobroker/at-context-server:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-kafka-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/history-entity-manager:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/history-query-manager:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/registry-subscription-manager:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/registry-manager:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/subscription-manager:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/query-manager:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/entity-manager:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/all-in-one-runner:java-kafka-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-kafka-${{steps.get-id.outputs.id}}
      - name: start docker aaio
        run: |
          docker-compose -f ./compose-files/docker-compose-java-aaio-kafka-test.yml up &
          sleep 120
      - name: newman action
        uses: matt-ball/newman-action@master
        with:
          collection: api-test.json
          environment: api-test-aaio-environment.json
      - name: Stopping Scorpio
        run: docker-compose -f ./compose-files/docker-compose-java-aaio-kafka-test.yml down
#      - name: start docker dist
#        run: |
#          docker-compose -f ./compose-files/docker-compose-java-dist-kafka-test.yml up &
#          sleep 120
#      - name: newman action
#        uses: matt-ball/newman-action@master
#        with:
#          collection: api-test.json
#          environment: api-test-dist-environment.json
#      - name: Stopping Scorpio
#        run: docker-compose -f ./compose-files/docker-compose-java-dist-kafka-test.yml down
      - name: docker-login
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKER_USER }}
          password: ${{ secrets.DOCKER_TOKEN }}
      - name: docker tag and push
        run: |
          docker push scorpiobroker/at-context-server:java-kafka-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/history-entity-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/history-query-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/registry-subscription-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/registry-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/subscription-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/query-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/entity-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/all-in-one-runner:java-kafka-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/at-context-server:java-kafka-latest
          docker push scorpiobroker/history-entity-manager:java-kafka-latest
          docker push scorpiobroker/history-query-manager:java-kafka-latest
          docker push scorpiobroker/registry-subscription-manager:java-kafka-latest
          docker push scorpiobroker/registry-manager:java-kafka-latest
          docker push scorpiobroker/subscription-manager:java-kafka-latest
          docker push scorpiobroker/query-manager:java-kafka-latest
          docker push scorpiobroker/entity-manager:java-kafka-latest
          docker push scorpiobroker/all-in-one-runner:java-kafka-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-kafka-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-kafka-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-kafka-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-kafka-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-kafka-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-kafka-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-kafka-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-kafka-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-kafka-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-kafka-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-kafka-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-kafka-latest
      - name: Create Release ${{steps.get-id.outputs.id}}-java-kafka
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          tag_name: ${{steps.get-id.outputs.id}}-java-kafka
          release_name: ${{steps.get-id.outputs.id}}-java-kafka
          draft: false
          prerelease: false
          body_path: RELEASENOTES
      - name: Zip aaio release
        working-directory: AllInOneRunner/target/quarkus-app
        run: zip -qq -r all-in-one-runner.zip *
      - name: Upload Release all-in-one-runner
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./AllInOneRunner/target/quarkus-app/all-in-one-runner.zip
          asset_name: all-in-one-runner-java-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip at-context-server release
        working-directory: at-context-server/target/quarkus-app
        run: zip -qq -r at-context-server.zip *
      - name: Upload Release at-context-server
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./at-context-server/target/quarkus-app/at-context-server.zip
          asset_name: at-context-server-java-kafka-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip history-query-manager release
        working-directory: HistoryQueryManager/target/quarkus-app
        run: zip -qq -r history-query-manager.zip *
      - name: Upload Release history-query-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./HistoryQueryManager/target/quarkus-app/history-query-manager.zip
          asset_name: history-query-manager-java-kafka-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip history-entity-manager release
        working-directory: HistoryEntityManager/target/quarkus-app
        run: zip -qq -r history-entity-manager.zip *
      - name: Upload Release history-entity-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./HistoryEntityManager/target/quarkus-app/history-entity-manager.zip
          asset_name: history-entity-manager-java-kafka-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip registry-subscription-manager release
        working-directory: RegistrySubscriptionManager/target/quarkus-app
        run: zip -qq -r registry-subscription-manager.zip *
      - name: Upload Release registry-subscription-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./RegistrySubscriptionManager/target/quarkus-app/registry-subscription-manager.zip
          asset_name: registry-subscription-manager-java-kafka-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip registry-manager release
        working-directory: RegistryManager/target/quarkus-app
        run: zip -qq -r registry-manager.zip *
      - name: Upload Release registry-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./RegistryManager/target/quarkus-app/registry-manager.zip
          asset_name: registry-manager-java-kafka-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip subscription-manager release
        working-directory: SubscriptionManager/target/quarkus-app
        run: zip -qq -r subscription-manager.zip *
      - name: Upload Release subscription-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./SubscriptionManager/target/quarkus-app/subscription-manager.zip
          asset_name: subscription-manager-java-kafka-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip query-manager release
        working-directory: QueryManager/target/quarkus-app
        run: zip -qq -r query-manager.zip *
      - name: Upload Release query-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./QueryManager/target/quarkus-app/query-manager.zip
          asset_name: query-manager-java-kafka-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip entity-manager release
        working-directory: EntityManager/target/quarkus-app
        run: zip -qq -r entity-manager.zip *
      - name: Upload Release entity-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./EntityManager/target/quarkus-app/entity-manager.zip
          asset_name: entity-manager-java-kafka-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
  build-java-sqs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 1.17
        uses: actions/setup-java@v1
        with:
          java-version: 1.17
      - name: Install zip
        uses: montudor/action-zip@v1
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v2
        with:
          aws-access-key-id: ${{ secrets.ECR_ID }}
          aws-secret-access-key: ${{ secrets.ECR_TOKEN }}
          aws-region: us-east-1
      - name: Login to Amazon ECR
        id: login-ecr
        uses: aws-actions/amazon-ecr-login@v1
        with:
          registry-type: public
      - name: Build testserver
        run: |
          cd testserver
          docker build -t testserver .
      - name: Get release number
        id: get-id
        run: |
          id=$(echo ${{github.ref_name}} | cut -d/ -f2)
          echo "::set-output name=id::$id"
      - name: build-java-with-sqs
        run: |
          mvn clean package -DskipTests -Dsqs -Psqs -Ddocker -Ddocker-tag=java-sqs-${{steps.get-id.outputs.id}} -Dos=java -Dquarkus.profile=sqs
      - name: docker tag
        run: |
          docker tag scorpiobroker/at-context-server:java-sqs-${{steps.get-id.outputs.id}} scorpiobroker/at-context-server:java-sqs-latest
          docker tag scorpiobroker/history-entity-manager:java-sqs-${{steps.get-id.outputs.id}} scorpiobroker/history-entity-manager:java-sqs-latest
          docker tag scorpiobroker/history-query-manager:java-sqs-${{steps.get-id.outputs.id}} scorpiobroker/history-query-manager:java-sqs-latest
          docker tag scorpiobroker/registry-subscription-manager:java-sqs-${{steps.get-id.outputs.id}} scorpiobroker/registry-subscription-manager:java-sqs-latest
          docker tag scorpiobroker/registry-manager:java-sqs-${{steps.get-id.outputs.id}} scorpiobroker/registry-manager:java-sqs-latest
          docker tag scorpiobroker/subscription-manager:java-sqs-${{steps.get-id.outputs.id}} scorpiobroker/subscription-manager:java-sqs-latest
          docker tag scorpiobroker/query-manager:java-sqs-${{steps.get-id.outputs.id}} scorpiobroker/query-manager:java-sqs-latest
          docker tag scorpiobroker/entity-manager:java-sqs-${{steps.get-id.outputs.id}} scorpiobroker/entity-manager:java-sqs-latest
          docker tag scorpiobroker/all-in-one-runner:java-sqs-${{steps.get-id.outputs.id}} scorpiobroker/all-in-one-runner:java-sqs-latest
          docker tag scorpiobroker/at-context-server:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-sqs-latest
          docker tag scorpiobroker/history-entity-manager:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-sqs-latest
          docker tag scorpiobroker/history-query-manager:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-sqs-latest
          docker tag scorpiobroker/registry-subscription-manager:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-sqs-latest
          docker tag scorpiobroker/registry-manager:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-sqs-latest
          docker tag scorpiobroker/subscription-manager:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-sqs-latest
          docker tag scorpiobroker/query-manager:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-sqs-latest
          docker tag scorpiobroker/entity-manager:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-sqs-latest
          docker tag scorpiobroker/all-in-one-runner:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-sqs-latest
          docker tag scorpiobroker/at-context-server:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-sqs-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/history-entity-manager:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/history-query-manager:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/registry-subscription-manager:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/registry-manager:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/subscription-manager:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/query-manager:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/entity-manager:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/all-in-one-runner:java-sqs-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-sqs-${{steps.get-id.outputs.id}}
      - name: docker-login
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKER_USER }}
          password: ${{ secrets.DOCKER_TOKEN }}
      - name: docker tag and push
        run: |
          docker push scorpiobroker/at-context-server:java-sqs-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/history-entity-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/history-query-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/registry-subscription-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/registry-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/subscription-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/query-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/entity-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/all-in-one-runner:java-sqs-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/at-context-server:java-sqs-latest
          docker push scorpiobroker/history-entity-manager:java-sqs-latest
          docker push scorpiobroker/history-query-manager:java-sqs-latest
          docker push scorpiobroker/registry-subscription-manager:java-sqs-latest
          docker push scorpiobroker/registry-manager:java-sqs-latest
          docker push scorpiobroker/subscription-manager:java-sqs-latest
          docker push scorpiobroker/query-manager:java-sqs-latest
          docker push scorpiobroker/entity-manager:java-sqs-latest
          docker push scorpiobroker/all-in-one-runner:java-sqs-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-sqs-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-sqs-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-sqs-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-sqs-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-sqs-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-sqs-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-sqs-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-sqs-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-sqs-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-sqs-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-sqs-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-sqs-latest
      - name: Create Release ${{steps.get-id.outputs.id}}-java-sqs
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          tag_name: ${{steps.get-id.outputs.id}}-java-sqs
          release_name: ${{steps.get-id.outputs.id}}-java-sqs
          draft: false
          prerelease: false
          body_path: RELEASENOTES
      - name: Zip aaio release
        working-directory: AllInOneRunner/target/quarkus-app
        run: zip -qq -r all-in-one-runner.zip *
      - name: Upload Release all-in-one-runner
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./AllInOneRunner/target/quarkus-app/all-in-one-runner.zip
          asset_name: all-in-one-runner-java-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip at-context-server release
        working-directory: at-context-server/target/quarkus-app
        run: zip -qq -r at-context-server.zip *
      - name: Upload Release at-context-server
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./at-context-server/target/quarkus-app/at-context-server.zip
          asset_name: at-context-server-java-sqs-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip history-query-manager release
        working-directory: HistoryQueryManager/target/quarkus-app
        run: zip -qq -r history-query-manager.zip *
      - name: Upload Release history-query-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./HistoryQueryManager/target/quarkus-app/history-query-manager.zip
          asset_name: history-query-manager-java-sqs-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip history-entity-manager release
        working-directory: HistoryEntityManager/target/quarkus-app
        run: zip -qq -r history-entity-manager.zip *
      - name: Upload Release history-entity-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./HistoryEntityManager/target/quarkus-app/history-entity-manager.zip
          asset_name: history-entity-manager-java-sqs-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip registry-subscription-manager release
        working-directory: RegistrySubscriptionManager/target/quarkus-app
        run: zip -qq -r registry-subscription-manager.zip *
      - name: Upload Release registry-subscription-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./RegistrySubscriptionManager/target/quarkus-app/registry-subscription-manager.zip
          asset_name: registry-subscription-manager-java-sqs-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip registry-manager release
        working-directory: RegistryManager/target/quarkus-app
        run: zip -qq -r registry-manager.zip *
      - name: Upload Release registry-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./RegistryManager/target/quarkus-app/registry-manager.zip
          asset_name: registry-manager-java-sqs-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip subscription-manager release
        working-directory: SubscriptionManager/target/quarkus-app
        run: zip -qq -r subscription-manager.zip *
      - name: Upload Release subscription-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./SubscriptionManager/target/quarkus-app/subscription-manager.zip
          asset_name: subscription-manager-java-sqs-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip query-manager release
        working-directory: QueryManager/target/quarkus-app
        run: zip -qq -r query-manager.zip *
      - name: Upload Release query-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./QueryManager/target/quarkus-app/query-manager.zip
          asset_name: query-manager-java-sqs-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip entity-manager release
        working-directory: EntityManager/target/quarkus-app
        run: zip -qq -r entity-manager.zip *
      - name: Upload Release entity-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./EntityManager/target/quarkus-app/entity-manager.zip
          asset_name: entity-manager-java-sqs-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
  build-java-rabbitmq:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 1.17
        uses: actions/setup-java@v1
        with:
          java-version: 1.17
      - name: Install zip
        uses: montudor/action-zip@v1
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v2
        with:
          aws-access-key-id: ${{ secrets.ECR_ID }}
          aws-secret-access-key: ${{ secrets.ECR_TOKEN }}
          aws-region: us-east-1
      - name: Login to Amazon ECR
        id: login-ecr
        uses: aws-actions/amazon-ecr-login@v1
        with:
          registry-type: public
      - name: Build testserver
        run: |
          cd testserver
          docker build -t testserver .
      - name: Get release number
        id: get-id
        run: |
          id=$(echo ${{github.ref_name}} | cut -d/ -f2)
          echo "::set-output name=id::$id"
      - name: build-java-with-rabbitmq
        run: |
          mvn clean package -DskipTests -Drabbitmq -Prabbitmq -Ddocker -Ddocker-tag=java-rabbitmq-${{steps.get-id.outputs.id}} -Dos=java -Dquarkus.profile=rabbitmq
      - name: docker tag
        run: |
          docker tag scorpiobroker/at-context-server:java-rabbitmq-${{steps.get-id.outputs.id}} scorpiobroker/at-context-server:java-rabbitmq-latest
          docker tag scorpiobroker/history-entity-manager:java-rabbitmq-${{steps.get-id.outputs.id}} scorpiobroker/history-entity-manager:java-rabbitmq-latest
          docker tag scorpiobroker/history-query-manager:java-rabbitmq-${{steps.get-id.outputs.id}} scorpiobroker/history-query-manager:java-rabbitmq-latest
          docker tag scorpiobroker/registry-subscription-manager:java-rabbitmq-${{steps.get-id.outputs.id}} scorpiobroker/registry-subscription-manager:java-rabbitmq-latest
          docker tag scorpiobroker/registry-manager:java-rabbitmq-${{steps.get-id.outputs.id}} scorpiobroker/registry-manager:java-rabbitmq-latest
          docker tag scorpiobroker/subscription-manager:java-rabbitmq-${{steps.get-id.outputs.id}} scorpiobroker/subscription-manager:java-rabbitmq-latest
          docker tag scorpiobroker/query-manager:java-rabbitmq-${{steps.get-id.outputs.id}} scorpiobroker/query-manager:java-rabbitmq-latest
          docker tag scorpiobroker/entity-manager:java-rabbitmq-${{steps.get-id.outputs.id}} scorpiobroker/entity-manager:java-rabbitmq-latest
          docker tag scorpiobroker/all-in-one-runner:java-rabbitmq-${{steps.get-id.outputs.id}} scorpiobroker/all-in-one-runner:java-rabbitmq-latest
          docker tag scorpiobroker/at-context-server:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-rabbitmq-latest
          docker tag scorpiobroker/history-entity-manager:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-rabbitmq-latest
          docker tag scorpiobroker/history-query-manager:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-rabbitmq-latest
          docker tag scorpiobroker/registry-subscription-manager:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-rabbitmq-latest
          docker tag scorpiobroker/registry-manager:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-rabbitmq-latest
          docker tag scorpiobroker/subscription-manager:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-rabbitmq-latest
          docker tag scorpiobroker/query-manager:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-rabbitmq-latest
          docker tag scorpiobroker/entity-manager:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-rabbitmq-latest
          docker tag scorpiobroker/all-in-one-runner:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-rabbitmq-latest
          docker tag scorpiobroker/at-context-server:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/history-entity-manager:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/history-query-manager:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/registry-subscription-manager:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/registry-manager:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/subscription-manager:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/query-manager:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/entity-manager:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/all-in-one-runner:java-rabbitmq-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-rabbitmq-${{steps.get-id.outputs.id}}
      - name: start docker aaio
        run: |
          docker-compose -f ./compose-files/docker-compose-java-aaio-rabbitmq-test.yml up &
          sleep 120
      - name: newman action
        uses: matt-ball/newman-action@master
        with:
          collection: api-test.json
          environment: api-test-aaio-environment.json
      - name: Stopping Scorpio
        run: docker-compose -f ./compose-files/docker-compose-java-aaio-rabbitmq-test.yml down
#      - name: start docker dist
#        run: |
#          docker-compose -f ./compose-files/docker-compose-java-dist-rabbitmq-test.yml up &
#          sleep 120
#      - name: newman action
#        uses: matt-ball/newman-action@master
#        with:
#          collection: api-test.json
#          environment: api-test-dist-environment.json
#      - name: Stopping Scorpio
#        run: docker-compose -f ./compose-files/docker-compose-java-dist-rabbitmq-test.yml down
      - name: docker-login
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKER_USER }}
          password: ${{ secrets.DOCKER_TOKEN }}
      - name: docker tag and push
        run: |
          docker push scorpiobroker/at-context-server:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/history-entity-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/history-query-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/registry-subscription-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/registry-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/subscription-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/query-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/entity-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/all-in-one-runner:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/at-context-server:java-rabbitmq-latest
          docker push scorpiobroker/history-entity-manager:java-rabbitmq-latest
          docker push scorpiobroker/history-query-manager:java-rabbitmq-latest
          docker push scorpiobroker/registry-subscription-manager:java-rabbitmq-latest
          docker push scorpiobroker/registry-manager:java-rabbitmq-latest
          docker push scorpiobroker/subscription-manager:java-rabbitmq-latest
          docker push scorpiobroker/query-manager:java-rabbitmq-latest
          docker push scorpiobroker/entity-manager:java-rabbitmq-latest
          docker push scorpiobroker/all-in-one-runner:java-rabbitmq-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-rabbitmq-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-rabbitmq-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-rabbitmq-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-rabbitmq-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-rabbitmq-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-rabbitmq-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-rabbitmq-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-rabbitmq-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-rabbitmq-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-rabbitmq-latest
      - name: Create Release ${{steps.get-id.outputs.id}}-java-rabbitmq
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          tag_name: ${{steps.get-id.outputs.id}}-java-rabbitmq
          release_name: ${{steps.get-id.outputs.id}}-java-rabbitmq
          draft: false
          prerelease: false
          body_path: RELEASENOTES
      - name: Zip aaio release
        working-directory: AllInOneRunner/target/quarkus-app
        run: zip -qq -r all-in-one-runner.zip *
      - name: Upload Release all-in-one-runner
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./AllInOneRunner/target/quarkus-app/all-in-one-runner.zip
          asset_name: all-in-one-runner-java-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip at-context-server release
        working-directory: at-context-server/target/quarkus-app
        run: zip -qq -r at-context-server.zip *
      - name: Upload Release at-context-server
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./at-context-server/target/quarkus-app/at-context-server.zip
          asset_name: at-context-server-java-rabbitmq-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip history-query-manager release
        working-directory: HistoryQueryManager/target/quarkus-app
        run: zip -qq -r history-query-manager.zip *
      - name: Upload Release history-query-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./HistoryQueryManager/target/quarkus-app/history-query-manager.zip
          asset_name: history-query-manager-java-rabbitmq-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip history-entity-manager release
        working-directory: HistoryEntityManager/target/quarkus-app
        run: zip -qq -r history-entity-manager.zip *
      - name: Upload Release history-entity-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./HistoryEntityManager/target/quarkus-app/history-entity-manager.zip
          asset_name: history-entity-manager-java-rabbitmq-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip registry-subscription-manager release
        working-directory: RegistrySubscriptionManager/target/quarkus-app
        run: zip -qq -r registry-subscription-manager.zip *
      - name: Upload Release registry-subscription-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./RegistrySubscriptionManager/target/quarkus-app/registry-subscription-manager.zip
          asset_name: registry-subscription-manager-java-rabbitmq-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip registry-manager release
        working-directory: RegistryManager/target/quarkus-app
        run: zip -qq -r registry-manager.zip *
      - name: Upload Release registry-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./RegistryManager/target/quarkus-app/registry-manager.zip
          asset_name: registry-manager-java-rabbitmq-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip subscription-manager release
        working-directory: SubscriptionManager/target/quarkus-app
        run: zip -qq -r subscription-manager.zip *
      - name: Upload Release subscription-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./SubscriptionManager/target/quarkus-app/subscription-manager.zip
          asset_name: subscription-manager-java-rabbitmq-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip query-manager release
        working-directory: QueryManager/target/quarkus-app
        run: zip -qq -r query-manager.zip *
      - name: Upload Release query-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./QueryManager/target/quarkus-app/query-manager.zip
          asset_name: query-manager-java-rabbitmq-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip entity-manager release
        working-directory: EntityManager/target/quarkus-app
        run: zip -qq -r entity-manager.zip *
      - name: Upload Release entity-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./EntityManager/target/quarkus-app/entity-manager.zip
          asset_name: entity-manager-java-rabbitmq-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
  build-java-mqtt:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 1.17
        uses: actions/setup-java@v1
        with:
          java-version: 1.17
      - name: Install zip
        uses: montudor/action-zip@v1
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v2
        with:
          aws-access-key-id: ${{ secrets.ECR_ID }}
          aws-secret-access-key: ${{ secrets.ECR_TOKEN }}
          aws-region: us-east-1
      - name: Login to Amazon ECR
        id: login-ecr
        uses: aws-actions/amazon-ecr-login@v1
        with:
          registry-type: public
      - name: Build testserver
        run: |
          cd testserver
          docker build -t testserver .
      - name: Get release number
        id: get-id
        run: |
          id=$(echo ${{github.ref_name}} | cut -d/ -f2)
          echo "::set-output name=id::$id"
      - name: build-java-with-mqtt
        run: |
          mvn clean package -DskipTests -Dmqtt -Pmqtt -Ddocker -Ddocker-tag=java-mqtt-${{steps.get-id.outputs.id}} -Dos=java -Dquarkus.profile=mqtt
      - name: docker tag
        run: |
          docker tag scorpiobroker/at-context-server:java-mqtt-${{steps.get-id.outputs.id}} scorpiobroker/at-context-server:java-mqtt-latest
          docker tag scorpiobroker/history-entity-manager:java-mqtt-${{steps.get-id.outputs.id}} scorpiobroker/history-entity-manager:java-mqtt-latest
          docker tag scorpiobroker/history-query-manager:java-mqtt-${{steps.get-id.outputs.id}} scorpiobroker/history-query-manager:java-mqtt-latest
          docker tag scorpiobroker/registry-subscription-manager:java-mqtt-${{steps.get-id.outputs.id}} scorpiobroker/registry-subscription-manager:java-mqtt-latest
          docker tag scorpiobroker/registry-manager:java-mqtt-${{steps.get-id.outputs.id}} scorpiobroker/registry-manager:java-mqtt-latest
          docker tag scorpiobroker/subscription-manager:java-mqtt-${{steps.get-id.outputs.id}} scorpiobroker/subscription-manager:java-mqtt-latest
          docker tag scorpiobroker/query-manager:java-mqtt-${{steps.get-id.outputs.id}} scorpiobroker/query-manager:java-mqtt-latest
          docker tag scorpiobroker/entity-manager:java-mqtt-${{steps.get-id.outputs.id}} scorpiobroker/entity-manager:java-mqtt-latest
          docker tag scorpiobroker/all-in-one-runner:java-mqtt-${{steps.get-id.outputs.id}} scorpiobroker/all-in-one-runner:java-mqtt-latest
          docker tag scorpiobroker/at-context-server:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-mqtt-latest
          docker tag scorpiobroker/history-entity-manager:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-mqtt-latest
          docker tag scorpiobroker/history-query-manager:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-mqtt-latest
          docker tag scorpiobroker/registry-subscription-manager:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-mqtt-latest
          docker tag scorpiobroker/registry-manager:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-mqtt-latest
          docker tag scorpiobroker/subscription-manager:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-mqtt-latest
          docker tag scorpiobroker/query-manager:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-mqtt-latest
          docker tag scorpiobroker/entity-manager:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-mqtt-latest
          docker tag scorpiobroker/all-in-one-runner:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-mqtt-latest
          docker tag scorpiobroker/at-context-server:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-mqtt-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/history-entity-manager:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/history-query-manager:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/registry-subscription-manager:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/registry-manager:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/subscription-manager:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/query-manager:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/entity-manager:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker tag scorpiobroker/all-in-one-runner:java-mqtt-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-mqtt-${{steps.get-id.outputs.id}}
      - name: start docker aaio
        run: |
          docker-compose -f ./compose-files/docker-compose-java-aaio-mqtt-test.yml up &
          sleep 120
#      - name: newman action
#        uses: matt-ball/newman-action@master
#        with:
#          collection: api-test.json
#          environment: api-test-aaio-environment.json
      - name: Stopping Scorpio
        run: docker-compose -f ./compose-files/docker-compose-java-aaio-mqtt-test.yml down
#      - name: start docker dist
#        run: |
#          docker-compose -f ./compose-files/docker-compose-java-dist-mqtt-test.yml up &
#          sleep 120
#      - name: newman action
#        uses: matt-ball/newman-action@master
#        with:
#          collection: api-test.json
#          environment: api-test-dist-environment.json
#      - name: Stopping Scorpio
#        run: docker-compose -f ./compose-files/docker-compose-java-dist-mqtt-test.yml down
      - name: docker-login
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKER_USER }}
          password: ${{ secrets.DOCKER_TOKEN }}
      - name: docker tag and push
        run: |
          docker push scorpiobroker/at-context-server:java-mqtt-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/history-entity-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/history-query-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/registry-subscription-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/registry-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/subscription-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/query-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/entity-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/all-in-one-runner:java-mqtt-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/at-context-server:java-mqtt-latest
          docker push scorpiobroker/history-entity-manager:java-mqtt-latest
          docker push scorpiobroker/history-query-manager:java-mqtt-latest
          docker push scorpiobroker/registry-subscription-manager:java-mqtt-latest
          docker push scorpiobroker/registry-manager:java-mqtt-latest
          docker push scorpiobroker/subscription-manager:java-mqtt-latest
          docker push scorpiobroker/query-manager:java-mqtt-latest
          docker push scorpiobroker/entity-manager:java-mqtt-latest
          docker push scorpiobroker/all-in-one-runner:java-mqtt-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-mqtt-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-mqtt-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-mqtt-${{steps.get-id.outputs.id}}
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/at-context-server:java-mqtt-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-entity-manager:java-mqtt-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/history-query-manager:java-mqtt-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-subscription-manager:java-mqtt-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/registry-manager:java-mqtt-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/subscription-manager:java-mqtt-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/query-manager:java-mqtt-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/entity-manager:java-mqtt-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-mqtt-latest
      - name: Create Release ${{steps.get-id.outputs.id}}-java-mqtt
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          tag_name: ${{steps.get-id.outputs.id}}-java-mqtt
          release_name: ${{steps.get-id.outputs.id}}-java-mqtt
          draft: false
          prerelease: false
          body_path: RELEASENOTES
      - name: Zip aaio release
        working-directory: AllInOneRunner/target/quarkus-app
        run: zip -qq -r all-in-one-runner.zip *
      - name: Upload Release all-in-one-runner
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./AllInOneRunner/target/quarkus-app/all-in-one-runner.zip
          asset_name: all-in-one-runner-java-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip at-context-server release
        working-directory: at-context-server/target/quarkus-app
        run: zip -qq -r at-context-server.zip *
      - name: Upload Release at-context-server
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./at-context-server/target/quarkus-app/at-context-server.zip
          asset_name: at-context-server-java-mqtt-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip history-query-manager release
        working-directory: HistoryQueryManager/target/quarkus-app
        run: zip -qq -r history-query-manager.zip *
      - name: Upload Release history-query-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./HistoryQueryManager/target/quarkus-app/history-query-manager.zip
          asset_name: history-query-manager-java-mqtt-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip history-entity-manager release
        working-directory: HistoryEntityManager/target/quarkus-app
        run: zip -qq -r history-entity-manager.zip *
      - name: Upload Release history-entity-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./HistoryEntityManager/target/quarkus-app/history-entity-manager.zip
          asset_name: history-entity-manager-java-mqtt-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip registry-subscription-manager release
        working-directory: RegistrySubscriptionManager/target/quarkus-app
        run: zip -qq -r registry-subscription-manager.zip *
      - name: Upload Release registry-subscription-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./RegistrySubscriptionManager/target/quarkus-app/registry-subscription-manager.zip
          asset_name: registry-subscription-manager-java-mqtt-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip registry-manager release
        working-directory: RegistryManager/target/quarkus-app
        run: zip -qq -r registry-manager.zip *
      - name: Upload Release registry-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./RegistryManager/target/quarkus-app/registry-manager.zip
          asset_name: registry-manager-java-mqtt-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip subscription-manager release
        working-directory: SubscriptionManager/target/quarkus-app
        run: zip -qq -r subscription-manager.zip *
      - name: Upload Release subscription-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./SubscriptionManager/target/quarkus-app/subscription-manager.zip
          asset_name: subscription-manager-java-mqtt-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip query-manager release
        working-directory: QueryManager/target/quarkus-app
        run: zip -qq -r query-manager.zip *
      - name: Upload Release query-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./QueryManager/target/quarkus-app/query-manager.zip
          asset_name: query-manager-java-mqtt-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
      - name: Zip entity-manager release
        working-directory: EntityManager/target/quarkus-app
        run: zip -qq -r entity-manager.zip *
      - name: Upload Release entity-manager
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./EntityManager/target/quarkus-app/entity-manager.zip
          asset_name: entity-manager-java-mqtt-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip
  build-java-aaio:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 1.17
        uses: actions/setup-java@v1
        with:
          java-version: 1.17
      - name: Install zip
        uses: montudor/action-zip@v1
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v2
        with:
          aws-access-key-id: ${{ secrets.ECR_ID }}
          aws-secret-access-key: ${{ secrets.ECR_TOKEN }}
          aws-region: us-east-1
      - name: Login to Amazon ECR
        id: login-ecr
        uses: aws-actions/amazon-ecr-login@v1
        with:
          registry-type: public

      - name: Build testserver
        run: |
          cd testserver
          docker build -t testserver .
      - name: Get release number
        id: get-id
        run: |
          id=$(echo ${{github.ref_name}} | cut -d/ -f2)
          echo "::set-output name=id::$id"
      - name: build-java
        run: |
          mvn clean package -DskipTests -Din-memory -Pin-memory -Ddocker -Ddocker-tag=java-${{steps.get-id.outputs.id}} -Dos=java -Dquarkus.profile=in-memory
      - name: docker tag
        run: |
          docker tag scorpiobroker/all-in-one-runner:java-${{steps.get-id.outputs.id}} scorpiobroker/all-in-one-runner:java-latest
          docker tag scorpiobroker/all-in-one-runner:java-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-latest
          docker tag scorpiobroker/all-in-one-runner:java-${{steps.get-id.outputs.id}} ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-${{steps.get-id.outputs.id}}
      - name: start docker aaio
        run: |
          docker-compose -f ./compose-files/docker-compose-java-aaio-test.yml up &
          sleep 120
      - name: newman action
        uses: matt-ball/newman-action@master
        with:
          collection: api-test.json
          environment: api-test-aaio-environment.json
      - name: Stopping Scorpio
        run: docker-compose -f ./compose-files/docker-compose-java-aaio-test.yml down
      - name: docker-login
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKER_USER }}
          password: ${{ secrets.DOCKER_TOKEN }}
      - name: docker push
        run: |
          docker push scorpiobroker/all-in-one-runner:java-${{steps.get-id.outputs.id}}
          docker push scorpiobroker/all-in-one-runner:java-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-latest
          docker push ${{ steps.login-ecr.outputs.registry }}/scorpiobroker/all-in-one-runner:java-${{steps.get-id.outputs.id}}
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          tag_name: ${{steps.get-id.outputs.id}}-java
          release_name: ${{steps.get-id.outputs.id}}-java
          draft: false
          prerelease: false
          body_path: RELEASENOTES
      - name: Zip aaio release
        working-directory: AllInOneRunner/target/quarkus-app
        run: zip -qq -r all-in-one-runner.zip *
      - name: Upload Release all-in-one-runner
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.SUPER_SECRET }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
          asset_path: ./AllInOneRunner/target/quarkus-app/all-in-one-runner.zip
          asset_name: all-in-one-runner-java-${{steps.get-id.outputs.id}}.zip
          asset_content_type: application/zip