Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #310 from sandeep-deriv/sandeep/fix-yml-actions
Browse files Browse the repository at this point in the history
chore: added vars for workflows
  • Loading branch information
sandeep-deriv authored Apr 3, 2024
2 parents fc69c21 + 9c1348d commit f7a5c24
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .github/actions/deploy_to_kubernetes/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ runs:
steps:
- name: Deploying to k8s cluster for service ${{ inputs.K8S_NAMESPACE }} 🚀
env:
K8S_VERSION: ${{ inputs.K8S_VERSION }}
NAMESPACE: ${{ inputs.K8S_NAMESPACE }}
KUBE_SERVER: ${{ inputs.KUBE_SERVER }}
SERVICEACCOUNT_TOKEN: ${{ inputs.SERVICEACCOUNT_TOKEN }}
DOCKERHUB_ORGANISATION: ${{ inputs.DOCKERHUB_ORGANISATION }}
CA_CRT: ${{ inputs.CA_CRT }}
APP_NAME: deriv-com-api
K8S_VERSION: ${{ inputs.K8S_VERSION }}

run: |
git clone https://github.com/binary-com/devops-ci-scripts
cd devops-ci-scripts/k8s-build_tools
Expand Down
12 changes: 5 additions & 7 deletions .github/actions/notify_slack/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ runs:
using: composite
steps:
- name: Send Slack Notification
run: |-
curl -X POST -H 'Content-type: application/json' \
--data '{
"text": "${{ inputs.MESSAGE }}",
}' \
${{ inputs.SLACK_WEBHOOK_URL }}
shell: bash
uses: 'deriv-com/shared-actions/.github/actions/send_slack_notification@master'
with:
SLACK_WEBHOOK_URL: ${{ inputs.SLACK_WEBHOOK_URL }}
MESSAGE: ${{ inputs.MESSAGE }}

25 changes: 20 additions & 5 deletions .github/actions/publish_to_docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,33 @@ runs:
using: composite
steps:
- name: Building docker image 🐳
env:
DOCKERHUB_ORGANISATION: ${{ inputs.DOCKERHUB_ORGANISATION }}
DOCKER_IMAGE_TAG: ${{ inputs.DOCKER_IMAGE_TAG }}
DOCKER_LATEST_IMAGE_TAG: ${{ inputs.DOCKER_LATEST_IMAGE_TAG }}
run: |
docker build -t ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_IMAGE_TAG }} -t ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }} .
docker build -t $DOCKERHUB_ORGANISATION/deriv-com-api:$DOCKER_IMAGE_TAG -t $DOCKERHUB_ORGANISATION/deriv-com-api:$DOCKER_LATEST_IMAGE_TAG .
shell: bash

- name: Verify nginx image
env:
DOCKERHUB_ORGANISATION: ${{ inputs.DOCKERHUB_ORGANISATION }}
DOCKER_LATEST_IMAGE_TAG: ${{ inputs.DOCKER_LATEST_IMAGE_TAG }}
run: |
set -e
docker run --rm ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }} nginx -t
docker run --rm $DOCKERHUB_ORGANISATION/deriv-com-api:$DOCKER_LATEST_IMAGE_TAG nginx -t
echo "docker image validated successfully"
shell: bash

- name: Pushing Image to docker hub 🐳
env:
DOCKERHUB_ORGANISATION: ${{ inputs.DOCKERHUB_ORGANISATION }}
DOCKER_IMAGE_TAG: ${{ inputs.DOCKER_IMAGE_TAG }}
DOCKER_LATEST_IMAGE_TAG: ${{ inputs.DOCKER_LATEST_IMAGE_TAG }}
DOCKERHUB_PASSWORD: ${{ inputs.DOCKERHUB_PASSWORD }}
DOCKERHUB_USERNAME: ${{ inputs.DOCKERHUB_USERNAME }}
run: |
echo ${{ inputs.DOCKERHUB_PASSWORD }} | docker login -u ${{ inputs.DOCKERHUB_USERNAME }} --password-stdin
docker push ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_IMAGE_TAG }}
docker push ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }}
echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin
docker push $DOCKERHUB_ORGANISATION/deriv-com-api:$DOCKER_IMAGE_TAG
docker push $DOCKERHUB_ORGANISATION/deriv-com-api:$DOCKER_LATEST_IMAGE_TAG
shell: bash
5 changes: 4 additions & 1 deletion .github/actions/versioning/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ runs:
using: composite
steps:
- name: Tag build
run: echo "${{ inputs.RELEASE_TYPE }}--GITHUB_REF:${{ inputs.RELEASE_TAG }}--DATE:$(date -u +'%Y-%m-%dT%H:%M:%SZ')" > build/version.txt
env:
RELEASE_TYPE: ${{ inputs.RELEASE_TYPE }}
RELEASE_TAG: ${{ inputs.RELEASE_TAG }}
run: echo "$RELEASE_TYPE--GITHUB_REF:$RELEASE_TAG--DATE:$(date -u +'%Y-%m-%dT%H:%M:%SZ')" > build/version.txt
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/release_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ jobs:
uses: ./.github/actions/notify_slack
with:
RELEASE_TYPE: ${{ env.RELEASE_TYPE }}
MESSAGE: "'${{ env.RELEASE_TYPE }}' Docker Publish and Kubernetes Deployment for api.deriv.com with version *'${{ needs.build_and_publish.outputs.RELEASE_VERSION }}'* has Failed *"
MESSAGE: "'${{ env.RELEASE_TYPE }}' Release succeeded for api.deriv.com with version *'${{ needs.build_and_publish.outputs.RELEASE_VERSION }}'* has Failed *"

0 comments on commit f7a5c24

Please sign in to comment.