• Beta
Build & Publish your Workflow
  • 11 Feb 2021
  • 2 Minutes To Read
  • Share
  • Dark

Build & Publish your Workflow

  • Share
  • Dark

Build and Publish Workflows

This document will describe how to build and publish your Commands, Services, or Pipelines. Building a CTO.ai workflow requires our Command Line Interface(CLI).

The CTO.ai CLI runs in either MacOS or GNU/Linux terminal. Windows support is currently in beta. The CLI provides comprehensive features that will let you develop, run, debug, and publish your workflows.

1. Install CTO.ai CLI

Click here for instructions

2. Sign In

You can sign in to your CTO.ai account with:

ops account:signin

Once you are signed in, you can now run your workflows with the ops run command followed by the name of the workflow you want to run.

3. Create a Workflow

The quickest way to get started on a new workflow (Command, Service, or Pipeline) is to use our ops init scaffold to set up a base project. Below is an example process for creating a Command, that also works for creating Pipelines and Services.

ops init

ops init will present a few configuration options and then generate a scaffold workflow for you. Check out our Quick Start Guides to init with your favorite framework.

Here's a NodeJS example scaffold:

$ ops init    # generate new Op called 'example1'
$ ls -1a
index.js      # your source code would go here

The code of the workflow goes in the index.js file.
Check out the ops.yml and docker config and review our SDK for more information.

4. Build

The example above is a NodeJS workflow with an index.js file that holds the source code for the Command. When you make changes to either the code or configuration files, you need to rebuild your workflow.
The build step is where the different pieces of the workflow are packaged into one portable, shareable, containerized workflow.

From the folder of your workflow, build it with the ops build . command. The . indicates that you want to build the workflow that is in the current folder:

ops build .

This package still only exists on your computer.

5. Run/Test your workflow before you publish

Now that your workflow is built, you can run/test it (which still only exists locally) using the ops run command:

ops run .

Again, the . denotes the current folder— ops run will run the workflow in the current folder, which in this case is example1.

6. Publish

Once your workflow has been packaged using the ops build command, you can publish it to your current team with the ops publish command. When you publish, you’ll be able run the workflow remotely. You can publish multiple versions of your workflow to different teams.

ops publish <path/opName>

As part of the publishing process, you’ll be asked for a short changelog description of what is in the new version.

Your workflow will be published to your Team and can be found using ops list.

7. Add Teammates

When you add a team member to your CTO.ai team they can run all of your team's workflows.

For more infomation on working with Teams, check out the Teams Page.

🚀 What's next?

📞 Need help? No problem!

Was This Article Helpful?