In modern software development, Continuous Integration and Continuous Deployment (CI/CD) aren't just best practices; they are the bedrock of reliable, scalable, and fast-moving teams. We use Git to version control our application code, and automated pipelines to test and deploy it. But what about the business logic that powers our operations? What about our automation workflows?
If we embrace the "Business-as-Code" philosophy—where critical business processes are defined, versioned, and managed just like software—then it stands to reason that our workflows deserve the same robust CI/CD treatment.
This is where the power of event-driven orchestration shines. With Triggers.do, you can use events from your development lifecycle, like a git push to a specific branch, to automate the deployment and management of your automation workflows. It's time to automate your automation.
Manually updating a critical workflow—like order processing or user onboarding—can be a nerve-wracking process. Did you copy the right version? Did you deploy it to the correct environment? Treating your workflows as code and building a CI/CD pipeline around them provides immediate, tangible benefits:
Let's walk through how to create a simple yet powerful pipeline that automatically deploys a workflow when changes are merged into the main branch of your repository. The entire process hinges on a single, powerful concept: a Triggers.do trigger that listens for a GitHub webhook.
This is the core mantra of Triggers.do. Here’s how it applies to our CI/CD use case:
Here's what the trigger definition looks like in code. Notice how the filter is the key to making this work.
import { Trigger } from 'triggers.do';
// This trigger listens for pushes to the 'main' branch in our workflows repository.
const deployProductionWorkflowTrigger = new Trigger({
name: 'Deploy Workflows on Main Push',
description: 'Automatically deploys workflow changes pushed to the main branch.',
event: 'webhook.received', // Generic event for incoming webhooks
source: 'github-webhook', // A specific, named source for GitHub
filter: {
// Filter for the 'push' event on the 'main' branch
condition: "event.headers['X-GitHub-Event'] == 'push' && event.body.ref == 'refs/heads/main'",
priority: 'critical'
},
handler: async (event) => {
// The event payload from GitHub contains repository info
const repoName = event.body.repository.full_name;
const commitId = event.body.after;
console.log(`New commit ${commitId} to main branch of ${repoName}. Initiating deploy workflow.`);
// Initiate a separate 'deploy-from-git' workflow
return {
workflow: 'deploy-from-git',
input: {
repository: repoName,
commit: commitId,
environment: 'production'
}
};
}
});
The trigger itself is simple. Its only job is to start another, more complex agentic workflow. This deploy-from-git workflow would be responsible for the actual deployment logic, which might include steps like:
This separation of concerns is critical. The trigger is a lightweight listener, while the workflow is a robust, stateful business process.
Once you have this basic pipeline in place, you can expand it to cover the entire development lifecycle.
By moving your workflow management into a CI/CD pipeline, you transform your business automation from a series of manual tasks into a reliable, version-controlled, and scalable software system. Triggers.do provides the event-driven backbone that makes this possible, allowing you to connect your development tools directly to your orchestration platform.
Ready to put your Business-as-Code on autopilot? Explore Triggers.do and start building your event-driven future today.