JSON Schema Update #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deriv Api Docs Production Workflow | |
on: | |
push: | |
tags: | |
- production_v* | |
env: | |
RELEASE_TYPE: Production | |
jobs: | |
build_and_publish: | |
name: Builds and Publishes to Cloudflare Pages Production | |
environment: Production | |
runs-on: ubuntu-latest | |
outputs: | |
RELEASE_VERSION: ${{ steps.extract_version.outputs.RELEASE_VERSION }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- name: Setup Node | |
uses: ./.github/actions/setup_node | |
- name: Install dependencies | |
uses: ./.github/actions/npm_install_from_cache | |
- name: Build | |
uses: ./.github/actions/build | |
with: | |
NODE_ENV: production | |
TRACKJS_TOKEN: ${{ secrets.TRACKJS_TOKEN }} | |
- name: Versioning | |
uses: ./.github/actions/versioning | |
with: | |
RELEASE_TAG: ${{ github.ref_name }} | |
RELEASE_TYPE: ${{ env.RELEASE_TYPE }} | |
- name: Extract version | |
id: extract_version | |
run: echo "RELEASE_VERSION=$(cat build/version.txt)" >> $GITHUB_OUTPUT | |
- name: Publish to Cloudflare Pages Production | |
uses: ./.github/actions/publish_to_pages_production | |
with: | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 | |
with: | |
name: build | |
path: build | |
retention-days: 1 | |
send_slack_notification: | |
name: Send Slack Notification | |
environment: Production | |
runs-on: ubuntu-latest | |
if: always() | |
needs: [build_and_publish] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- name: Conclusion | |
uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5 | |
- name: Create Slack Message | |
id: create_slack_message | |
run: | | |
if [ "$WORKFLOW_CONCLUSION" == "success" ]; then | |
echo "MESSAGE=$RELEASE_TYPE Release succeeded for api.deriv.com with version *${{ needs.build_and_publish.outputs.RELEASE_VERSION }}*" >> $GITHUB_OUTPUT | |
else | |
echo "MESSAGE=$RELEASE_TYPE Release failed for api.deriv.com with version *${{ needs.build_and_publish.outputs.RELEASE_VERSION }}*" >> $GITHUB_OUTPUT | |
fi | |
- name: Send Slack Notification | |
uses: ./.github/actions/notify_slack | |
with: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
MESSAGE: ${{ steps.create_slack_message.outputs.MESSAGE }} | |
build_and_publish_to_docker_k8s: | |
name: Builds and Publishes image to Docker and Kubernetes | |
runs-on: ubuntu-latest | |
environment: Production | |
needs: [build_and_publish] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- name: Download Build Artifact | |
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 | |
with: | |
name: build | |
path: build | |
- name: Publish to Docker | |
id: publish_to_docker | |
uses: ./.github/actions/publish_to_docker | |
with: | |
DOCKER_LATEST_IMAGE_TAG: 'latest' | |
DOCKER_IMAGE_TAG: ${{ github.ref_name }} | |
DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }} | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Deploy to Kubernetes | |
id: deploy_to_kubernetes | |
uses: ./.github/actions/deploy_to_kubernetes | |
with: | |
K8S_VERSION: ${{ github.ref_name }} | |
K8S_NAMESPACE: 'deriv-com-api-production' | |
CA_CRT: ${{ secrets.CA_CRT }} | |
SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }} | |
KUBE_SERVER: ${{ secrets.KUBE_SERVER }} | |
DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }} | |
- name: Send Slack Notification | |
if: ${{ steps.publish_to_docker.outcome != 'success' || steps.deploy_to_kubernetes.outcome != 'success' }} | |
uses: ./.github/actions/notify_slack | |
with: | |
RELEASE_TYPE: ${{ env.RELEASE_TYPE }} | |
MESSAGE: "'${{ env.RELEASE_TYPE }}' Release succeeded for api.deriv.com with version *'${{ needs.build_and_publish.outputs.RELEASE_VERSION }}'* has Failed *" |