# Enabling CI/CD on GitHub

To improve deployment stability, we recommend implementing CI/CD tools into your connector development workflow. This guide will go over the process if you're using Github and Github actions. This same logic, however, can be ported over to other Git tools and CI/CD tools.

# Prerequisites

  • You have a Github repository
  • Permissions in your GitHub repository that allow you to manage Actions
  • Permissions in your Github repository to set repository secrets

# Setting up GitHub Actions

Next, you'll create a GitHub Actions (opens new window) file. This file is used to define the steps the action will execute.

In your repository's .github/workflows folder, create a new ruby.yml file. For example:

name: Connector Unit Test

on: 
  pull_request:
    branches: [ main ]

jobs:
  test:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby-version: ['2.4.10', '2.5', '2.7']

    steps:
    - uses: actions/checkout@v2
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby-version }}
        bundler-cache: true 
    - name: Run tests
      env: # Only needed if using encrypted files.
        WORKATO_CONNECTOR_MASTER_KEY: ${{ secrets.WORKATO_CONNECTOR_MASTER_KEY }} 
      run: bundle exec rspec

In this example, our project is using encrypted settings (settings.yaml.enc). When using encryption, make sure to:

  • Add your project's master.key file to .gitignore, and
  • Set environment variables in your repository using encrypted secrets (opens new window). In this example, our variable is named WORKATO_CONNECTOR_MASTER_KEY.

# Adding other automated checks

You may choose to add other types of checks such as Rubocop (opens new window) which is a easy way to maintain code style.

# Automate deployment to Workato

Now, you might also want to automate the deployment of your connector to your DEV environment such that whenever a PR is merged, its automatically deployed to your workspace!

In your repository's .github/workflows folder, create a new ruby.yml file. For example:

name: Connector Unit Test & Deployment

on: 
  push:
    branches: [ main ]

jobs:
  test:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby-version: ['2.4.10', '2.5', '2.7']

    steps:
    - uses: actions/checkout@v2
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby-version }}
        bundler-cache: true 
    - name: Run tests
      env: # Only needed if using encrypted files.
        WORKATO_CONNECTOR_MASTER_KEY: ${{ secrets.WORKATO_CONNECTOR_MASTER_KEY }} 
      run: bundle exec rspec
    - name: Push to DEV workspace Use this to push to DEV. This can be enabled when a PR is merged.
      env: # Only needed if using encrypted files.
        WORKATO_API_TOKEN: ${{ secrets.WORKATO_DEV_ENVIRONMENT_API_TOKEN}} 
      run: bundle exec workato push -n "${{ github.event.head_commit.message }}" 

# What's next?


Last updated: 3/29/2023, 2:00:59 PM