diff --git a/.github/actions/build_and_push_docker_image/action.yml b/.github/actions/build_and_push_docker_image/action.yml index 82a7a96d3..5b5feb6cf 100644 --- a/.github/actions/build_and_push_docker_image/action.yml +++ b/.github/actions/build_and_push_docker_image/action.yml @@ -36,51 +36,31 @@ runs: echo "NAMESPACE=${{ inputs.K8S_NAMESPACE }}" >> "$GITHUB_ENV" echo "KUBE_SERVER=${{ inputs.KUBE_SERVER }}" >> "$GITHUB_ENV" echo "SERVICEACCOUNT_TOKEN=${{ inputs.SERVICEACCOUNT_TOKEN }}" >> "$GITHUB_ENV" + echo "DOCKERHUB_ORGANISATION=${{ inputs.DOCKERHUB_ORGANISATION }}" >> "$GITHUB_ENV" + echo "CA_CRT=${{ inputs.CA_CRT }}" >> "$GITHUB_ENV" + echo "APP_NAME=deriv-static-bot" >> "$GITHUB_ENV" + echo "APP_VERSION=${{ inputs.APP_VERSION }}" >> "$GITHUB_ENV" shell: bash - - name: Build docker image 🐳 - env: - GITHUB_REF_NAME: ${{ github.ref_name }} - DOCKERHUB_ORGANISATION: ${{ inputs.DOCKERHUB_ORGANISATION }} - APP_VERSION: ${{ inputs.APP_VERSION }} - APP_NAME: deriv-static-bot - run: docker build -t $DOCKERHUB_ORGANISATION/$APP_NAME:$APP_VERSION -t $DOCKERHUB_ORGANISATION/${APP_NAME}:$GITHUB_REF_NAME . + run: docker build -t ${DOCKERHUB_ORGANISATION}/${APP_NAME}:${APP_VERSION} -t ${DOCKERHUB_ORGANISATION}/${APP_NAME}:${{ github.ref_name }} . shell: bash - - name: Verify nginx image - env: - GITHUB_REF_NAME: ${{ github.ref_name }} - DOCKERHUB_ORGANISATION: ${{ inputs.DOCKERHUB_ORGANISATION }} - APP_NAME: deriv-static-bot run: | set -e - docker run --rm $DOCKERHUB_ORGANISATION/$APP_NAME:GITHUB_REF_NAME nginx -t + docker run --rm ${DOCKERHUB_ORGANISATION}/${APP_NAME}:${{ github.ref_name }} nginx -t echo "docker image validated successfully" shell: bash - - name: Pushing Image to docker hub 🐳 - env: - GITHUB_REF_NAME: ${{ github.ref_name }} - DOCKERHUB_ORGANISATION: ${{ inputs.DOCKERHUB_ORGANISATION }} - DOCKERHUB_PASSWORD: ${{ inputs.DOCKERHUB_PASSWORD }} - DOCKERHUB_USERNAME: ${{ inputs.DOCKERHUB_USERNAME }} - APP_VERSION: ${{ inputs.APP_VERSION }} - APP_NAME: deriv-static-bot run: | - echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin - docker push $DOCKERHUB_ORGANISATION/$APP_NAME:$APP_VERSION - docker push $DOCKERHUB_ORGANISATION/$APP_NAME:$GITHUB_REF_NAME + echo ${{ inputs.DOCKERHUB_PASSWORD }}| docker login -u ${{ inputs.DOCKERHUB_USERNAME }} --password-stdin + docker push ${DOCKERHUB_ORGANISATION}/${APP_NAME}:${APP_VERSION} + docker push ${DOCKERHUB_ORGANISATION}/${APP_NAME}:${{ github.ref_name }} shell: bash - - name: Deploy 🚀 - env: - GITHUB_REF_NAME: ${{ github.ref_name }} - CA_CRT: ${{ inputs.CA_CRT }} - APP_NAME: deriv-static-bot run: | git clone https://github.com/binary-com/devops-ci-scripts cd devops-ci-scripts/k8s-build_tools echo $CA_CRT | base64 --decode > ca.crt export CA="ca.crt" - ./release.sh $APP_NAME $GITHUB_REF_NAME + ./release.sh ${APP_NAME} ${{ github.ref_name }} shell: bash diff --git a/.github/actions/send_slack_notifications/action.yml b/.github/actions/send_slack_notifications/action.yml index 02c581189..141f9b612 100644 --- a/.github/actions/send_slack_notifications/action.yml +++ b/.github/actions/send_slack_notifications/action.yml @@ -18,23 +18,22 @@ runs: using: composite steps: - name: Send Slack Notification on Success - env: - RELEASE_TYPE: ${{ inputs.RELEASE_TYPE }} - VERSION: ${{ inputs.VERSION }} - SLACK_WEBHOOK_URL: ${{ inputs.SLACK_WEBHOOK_URL }} + if: inputs.status == 'success' - uses: 'deriv-com/shared-actions/.github/actions/send_slack_notification@master' - with: - SLACK_WEBHOOK_URL: $SLACK_WEBHOOK_URL - MESSAGE: "$RELEASE_TYPE Release succeeded for deriv bot with version $VERSION" + run: | + curl -X POST -H 'Content-type: application/json' \ + --data '{ + "text": "${{ inputs.RELEASE_TYPE }} Release succeeded for deriv bot with version ${{ inputs.VERSION }}" + }' \ + ${{ inputs.SLACK_WEBHOOK_URL }} + shell: bash - name: Send Slack Notification on Failure - env: - RELEASE_TYPE: ${{ inputs.RELEASE_TYPE }} - VERSION: ${{ inputs.VERSION }} - SLACK_WEBHOOK_URL: ${{ inputs.SLACK_WEBHOOK_URL }} if: inputs.status == 'failure' - uses: 'deriv-com/shared-actions/.github/actions/send_slack_notification@master' - with: - SLACK_WEBHOOK_URL: $SLACK_WEBHOOK_URL - MESSAGE: "$RELEASE_TYPE Release failed for deriv bot with version $VERSION" + run: | + curl -X POST -H 'Content-type: application/json' \ + --data '{ + "text": "${{ inputs.RELEASE_TYPE }} Release failed for deriv bot with version ${{ inputs.VERSION }}" + }' \ + ${{ inputs.SLACK_WEBHOOK_URL }} + shell: bash diff --git a/.github/actions/versioning/action.yml b/.github/actions/versioning/action.yml index fb0ce072a..12fe917ef 100644 --- a/.github/actions/versioning/action.yml +++ b/.github/actions/versioning/action.yml @@ -8,12 +8,9 @@ runs: using: composite steps: - name: Set version - env: - RELEASE_TYPE: ${{ inputs.RELEASE_TYPE }} - GITHUB_RUN_NUMBER: ${{ github.run_number }} run: | current_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ') - version="$RELEASE_TYPE-GH_Run#:$GITHUB_RUN_NUMBER-Date:$current_date" + version="${{ inputs.RELEASE_TYPE }}-GH_Run#:${{ github.run_number }}-Date:$current_date" echo "Setting version to: $version" echo "VERSION=$version" >> $GITHUB_ENV shell: bash