diff --git a/.github/workflows/tooljet-release-docker-image-build.yml b/.github/workflows/tooljet-release-docker-image-build.yml index 7a84d39bee..b26fcfa4b2 100644 --- a/.github/workflows/tooljet-release-docker-image-build.yml +++ b/.github/workflows/tooljet-release-docker-image-build.yml @@ -155,4 +155,55 @@ jobs: message="Job '${{ env.JOB_NAME }}' failed! tooljet/tooljet-ce:${{ github.event.inputs.image }}" fi + curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"$message\"}" ${{ secrets.SLACK_WEBHOOK_URL }} + + + update-lts-machine: + runs-on: ubuntu-latest + needs: build-tooljet-ce-image + + if: "contains(github.event.release.tag_name, 'CE-LTS')" + + steps: + - name: SSH into GCP VM instance + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.GCP_CE_LTS_INSTANCE_IP }} + username: ${{ secrets.GCP_USERNAME }} + key: ${{ secrets.EC2_INSTANCE_SSH_KEY }} + script: | + ls -lah + + # Stop the Docker containers + sudo docker-compose down + + # Check remaining images + sudo docker images + + # Remove the existing tooljet/* images + sudo docker images -a | grep 'tooljet/' | awk '{print $3}' | xargs sudo docker rmi -f + + # Check remaining images + sudo docker images + + # Update docker-compose.yml with the new image for tooljet service + sed -i '/^[[:space:]]*tooljet:/,/^[[:space:]]*[^:]*$/ { /^[[:space:]]*image:[[:space:]]*tooljet\/tooljet-ce/s|\(image:[[:space:]]*\).*|\1tooljet/tooljet-ce:'"${{ github.event.inputs.image }}"'| }' docker-compose.yml + + # check the updated docker-compose.yml file + cat docker-compose.yaml + + # Start the Docker containers + sudo docker-compose up -d + + #View containers + sudo docker ps + + - name: Send Slack Notification + run: | + if [[ "${{ job.status }}" == "success" ]]; then + message="CE-LTS test system with updated the image: `tooljet/tooljet-ce:${{ github.event.inputs.image }}`" + else + message="Failed to update the CE LTS test system" + fi + curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"$message\"}" ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file