Skip to main content

Workflow Automation

Automate complex App Store Connect workflows with multi-step sequences
Define and execute multi-step automation workflows that combine multiple CLI commands and shell scripts.

Overview

Workflows allow you to:
  • Chain multiple asc commands together
  • Run shell scripts and commands
  • Pass data between steps
  • Handle errors with hooks
  • Execute conditional steps
  • Compose reusable sub-workflows
Workflows intentionally execute arbitrary shell commands. Only run workflow files you trust, especially when using --file. Treat .asc/workflow.json like code: review it before running.

Quick Start

Create a Workflow File

Create .asc/workflow.json in your project:

Run a Workflow

List Available Workflows

Validate Workflow File

Workflow Structure

Basic Workflow

Environment Variables

Global Environment (env at root):
  • Available to all workflows
  • Merged with system environment
Workflow Environment (env in workflow):
  • Scoped to specific workflow
  • Overrides global variables
Runtime Parameters:
  • Passed via command line: KEY:VALUE
  • Override workflow environment
Precedence (highest to lowest):
  1. Runtime parameters
  2. Workflow env
  3. Global env
  4. System environment

Hooks

before_all: Runs before any workflow
after_all: Runs after successful workflow
error: Runs when workflow fails

Step Types

Command Steps

Execute shell commands:

Conditional Steps

Run only if a variable is set:
Skipped if BUILD_ID is empty or unset.

Sub-Workflow Steps

Call another workflow:
The called workflow receives EXTRA_VAR in addition to its own environment.

Complete Workflow Examples

Beta Distribution Workflow

Run with:

App Store Submission Workflow

Run with:

Complete Release Workflow

Run with:

CI/CD Integration

GitHub Actions

GitLab CI

Advanced Features

Dry Run Mode

Preview workflow execution without running commands:
Shows:
  • Steps that would be executed
  • Environment variables
  • Command interpolation
  • Workflow order

Private Workflows

Mark workflows as private (only callable from other workflows):
List including private workflows:

Custom Workflow File

Use a different workflow file:

Pretty JSON Output

Best Practices

  1. Use descriptive names: Name workflows and steps clearly
  2. Add descriptions: Document what each workflow does
  3. Validate before running: Always run asc workflow validate after editing
  4. Use environment variables: Parameterize workflows for reusability
  5. Handle errors: Define error hooks to clean up on failure
  6. Test with dry-run: Use --dry-run to preview execution
  7. Keep workflows focused: Break complex workflows into composable sub-workflows
  8. Version control workflows: Store .asc/workflow.json in git
  9. Document required parameters: Note required KEY:VALUE parameters in descriptions
  10. Use private workflows: Extract common logic into private sub-workflows

Security Considerations

  • Only run workflows from trusted sources
  • Review workflow files before execution
  • Avoid hardcoding secrets—use environment variables
  • In CI/CD, use encrypted secrets for credentials
  • Don’t run untrusted workflows on PRs with access to secrets

Safe Practices

Troubleshooting

Validation Errors

Problem: asc workflow validate reports errors. Solution: Check for:
  • Circular workflow dependencies
  • Missing workflow definitions
  • Invalid JSON syntax
  • Unknown step types

”Workflow not found”

Problem: Workflow name doesn’t exist in file. Solution: List available workflows:

Variable Not Interpolated

Problem: $VARIABLE appears literally in output. Solution: Ensure the variable is:
  • Defined in env (global or workflow)
  • Passed as runtime parameter: VARIABLE:value
  • Available in system environment

Step Fails Silently

Problem: Step executes but produces no output. Solution:
  • Check step output is written to stderr (workflow stdout is JSON-only)
  • Enable verbose mode (if available)
  • Add explicit echo statements

Workflow Hangs

Problem: Workflow stops and doesn’t complete. Solution:
  • Check for interactive commands (not supported)
  • Verify commands don’t wait for user input
  • Add timeout to long-running commands