diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 33a790f8336..abc7c2e6d19 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -52,7 +52,7 @@ jobs: - run: npm run test - run: npm run build - run: echo $GIT_TAG_NAME > public/version.txt - + - name: Remove Storybook uses: JesseTG/rm@v1.0.2 with: @@ -73,6 +73,27 @@ jobs: - name: Cloudflare production link ✨ run: echo "New website - http://cf-pages-deriv-com.deriv.com" + - name: Slack Notification 📣 + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: workflow,repo + if_mention: failure,cancelled + custom_payload: | + { + attachments: [{ + color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning', + text: `Release for *Deriv.com* with version *$GIT_TAG_NAME*` + }] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + if: always() + + build_and_publish_to_docker_k8s: + runs-on: Runner_8cores_Deriv-app + environment: production + steps: - name: Building docker image 🐳 run: docker build -t ${{ secrets.DOCKERHUB_ORGANISATION }}/deriv-com:latest -t ${{ secrets.DOCKERHUB_ORGANISATION }}/deriv-com:$GIT_TAG_NAME . @@ -89,12 +110,13 @@ jobs: docker push ${{ secrets.DOCKERHUB_ORGANISATION }}/deriv-com:$GIT_TAG_NAME - name: Deploy 🚀 + id: build_and_push_docker_image env: - KUBE_SERVER: ${{ secrets.KUBE_SERVER }} - SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }} - CA_CRT: ${{ secrets.CA_CRT }} - NAMESPACE: deriv-com-production - DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }} + KUBE_SERVER: ${{ secrets.KUBE_SERVER }} + SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }} + CA_CRT: ${{ secrets.CA_CRT }} + NAMESPACE: deriv-com-production + DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }} run: | git clone https://github.com/binary-com/devops-ci-scripts cd devops-ci-scripts/k8s-build_tools @@ -102,19 +124,19 @@ jobs: export CA="ca.crt" ./release.sh deriv-com ${{ github.ref_name }} - - name: Slack Notification 📣 + - name: Send Slack Notification on Docker Publish and Kubernetes Deployment Failure uses: 8398a7/action-slack@v3 with: status: ${{ job.status }} fields: workflow,repo if_mention: failure,cancelled custom_payload: | - { - attachments: [{ - color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning', - text: `Release for *Deriv.com* with version *$GIT_TAG_NAME*` - }] - } + { + attachments: [{ + color: '${{ job.status }}' === 'failure' ? 'danger' : 'warning', + text: `Release for *Deriv.com* with version *$GIT_TAG_NAME* has failed` + }] + } env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - if: always() + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + if: ${{ steps.build_and_push_docker_image.outcome != 'success' }}