Typically we will deploy resources to Kodexa using the Kodexa CLI, this allows us to deploy resources to Kodexa from the command line.

Deploying Resources

Lets consider a use-case where we have a fairly standard set of resources that we want to deploy to Kodexa.

Usually when we start with a project like this the key elements such as:

  • Taxonomy
  • Invoice Data Form
  • Transformer Model (optional)

We will create a manifest file that describes the resources that we want to deploy to Kodexa.

# This is a Manifest file
resources-paths:
  - "models/*.yml"
  - "resources/taxonomy.yml"
  - "resources/invoice-data-form.yml"

In order to start the process we will want to download each of these resources from the instance and then create a new GitHub repository to store the resources.

mkdir -p resources models   
kodexa get taxonom my-org/7644d17a-cbac-44b5-b756-731f793a763e-content:1.0.0 --output-path resources --output-file taxonomy.yml
kodexa get dataform my-org/7644d17a-cbac-44b5-b756-731f793a763e-data-form:1.0.0 --output-path resources --output-file invoice-data-form.yml

Once we have these files in place we can now commit the structure to the repository and create a pull request.

git add .
git commit -m "Initial commit of resources"
git push

Deployment using Github Actions

With Github Actions we can now deploy the resources to Kodexa.

To do this we will need to define a workflow file in the repository, this will make sure we have Python 3.11 and also ensure we have the kodexa-cli installed.

You will need to ensure you have set your access token and URL as secrets in the repository.
name: Deploy Resources

on:
  push: 
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Set up Python 3.11
        uses: actions/setup-python@v4
        with:
          python-version: 3.11
      - name: Install Kodexa CLI
        run: |
          python -m pip install --upgrade pip
          pip install kodexa-cli
      - name: Deploy Resources
        env:
          KODEXA_ACCESS_TOKEN: ${{ secrets.KODEXA_ACCESS_TOKEN }}
          KODEXA_URL: ${{ secrets.KODEXA_URL }}
        run: |
          kodexa manifest manifest.yml deploy