Configuring Github CICD workflow for Zoho Catalyst Web Client and Functions

Configuring Github CICD workflow for Zoho Catalyst Web Client and Functions

We can migrate our Catalyst project from the GitHub Repository to the Catalyst development environment using the Github workflow. You can learn more about the GitHub workflows here.

 

 Pre-requisites:

  1. Before setting up make sure you have the following data for your catalyst project
    • catalyst token
    • Catalyst project name
    • Catalyst Project Org ID
  2. To know how to set up a catalyst project, you can try this tutorial on a simple web application.
  3. You need to generate a CLI token for executing commands for your user account from Catalyst CLI by executing the following command:
  1. catalyst token:generate
    • This will initiate the token generation process. The CLI will display a URL that you can visit from any device. It will also generate a device verification code, which you must enter on the web page of the URL.
    • Navigate to the URL displayed in the CLI and enter the verification code. Click Verify. The code will only be valid for five minutes.
    • Once your device's CLI is verified, the token will be generated and displayed in your CLI.Do make a copy of that token.
  1. You can find your Catalyst Project name and Catalyst Org ID from the Catalyst Console Homepage: "https://console.catalyst.zoho.com/baas/{OrgID}/index"

CI/CD Setup:


  1. Navigate to the main branch of your GitHub repository where you stored your Catalyst project and create a Workflow Directory .github/workflows and create a YAML file called main.yml under the directory .github/workflows which contains the script code to run the workflow
  2. To know more about GitHub workflows kindly refer here.
  3. After setting up the runners based on your preference you need to paste the below code based on the type of functions your catalyst application is going to run on.

main.yml 

  1. name: Create Release
  2. on:
  3.   push:
  4.     branches:
  5. - 'main' 
  6. jobs: build: 
  7.     runs-on: ubuntu-latest
  8.     steps:
  9.       - uses: actions/checkout@v1
  10.       - name: Loading Node.js
  11.         uses: actions/setup-node@v2
  12.         with:
  13.           node-version: '18'

  14.       - name: Loading Java17
  15. uses: actions/setup-java@v4.0.0
  16. with:
  17.     java-version: '17'
  18.       distribution: 'oracle'
  19.       - name: Setup Python3.9
  20. uses: actions/setup-python@v5.0.0
  21. with:
  22.       python-version: '3.9.15'
  23.       - name: Installing catalyst
  24. run : npm i -g zcatalyst-cli
  25.       - name: Installing Packages for 'Node'
  26. run: cd functions/{your function name}/ && npm install --omit=dev
  27.       - name: Deploying code to catalyst
  28. run: catalyst deploy --project ${{secrets.CATALYST_PROJECT_NAME}} --org ${{secrets.CATALYST_ORG}} --token ${{ secrets.CATALYST_TOKEN}}

Before committing any changes you need to add the below Values in your repository secrets. You can find the help documentation for the same here.

CATALYST_PROJECT_NAME - Your Project Name

○  CATALYST_ORG - Your Project Org ID
○  CATALYST_TOKEN - Your catalyst token is generated using the command

  1. catalyst token:generate

After pasting the above-mentioned code snippet in your main.yml file once you do a commit, the workflow executes the job mentioned in the main.yml file. 



      Catalyst Community