Skip to main content

Workflow configuration

Define multi-step automation workflows in .asc/workflow.json
Workflows allow you to define multi-step automation sequences in a .asc/workflow.json file. This is useful for complex release processes that involve multiple commands.

Workflow file structure

Create a .asc/workflow.json file in your project root:

Running workflows

Execute a workflow by name:
Or use the short form:
When --file is omitted, the CLI looks for .asc/workflow.json in the current directory.

Workflow schema

Top-level fields

object
Global environment variables available to all workflows
string
Command to run before any workflow executesUseful for validation or setup tasks.
string
Command to run after a workflow completes successfullyUseful for cleanup or notifications.
string
Command to run if a workflow failsUseful for error notifications or rollback.
object
required
Map of workflow names to workflow definitions

Workflow fields

string
Human-readable description of the workflow
boolean
Hide this workflow from asc workflow listDefault: false
object
Workflow-specific environment variablesThese override global env variables.
array
required
List of steps to execute (see step format below)

Step formats

Steps can be defined in two formats: Short form (string):
Long form (object):

Step fields

string
Step name (displayed during execution)
string
Shell command to execute
string
Name of another workflow to run (sub-workflow)Mutually exclusive with run.
string
Condition expression (evaluated as shell command)Step runs only if the command exits with code 0.
object
Environment variables passed to the stepOnly applies to workflow steps.

Environment variable precedence

Environment variables are resolved in this order (highest to lowest):
  1. Runtime parameters (KEY:VALUE arguments to asc workflow run)
  2. Step with field (for sub-workflows)
  3. Workflow env field
  4. Global env field
  5. System environment variables
Example:
This overrides the APP_ID defined in the workflow file.

Conditional steps

Use the if field to conditionally execute steps:
The if condition is evaluated as a shell command. The step runs only if the command exits with code 0.

Sub-workflows

Call other workflows from within a workflow:

Lifecycle hooks

Workflow hooks run at specific points during execution:
  • before_all: Runs before any workflow starts
  • after_all: Runs after a workflow completes successfully
  • error: Runs if any step fails
Example with Slack notifications:

Complete example

Here’s a comprehensive workflow for a full release process:

CI/CD integration

GitHub Actions

GitLab CI

Security considerations

Workflow files execute arbitrary shell commands. Ensure:
  • .asc/workflow.json is added to .gitignore if it contains secrets
  • Use environment variables for sensitive values
  • Review workflow files before execution
  • Run workflows in trusted environments only

Troubleshooting

Workflow not found

Environment variable not expanded

Ensure variables are defined in the workflow file or passed as KEY:VALUE arguments:

Step fails silently

Check exit codes and stderr:

Workflow command

Workflow command reference

Automation guide

Workflow automation patterns