Skip to main content

Workflows

Automate multi-step tasks by composing CLI commands and shell scripts in declarative JSON workflows.
Workflows let you define reusable, multi-step automation sequences in a declarative JSON file. Think of workflows as lightweight CI/CD pipelines for App Store Connect tasks.

Quick Start

Create a workflow file at .asc/workflow.json:
Run it:

Workflow File Structure

Workflows are defined in .asc/workflow.json (or a custom path with --file).

Top-Level Schema

Workflow Schema

Step Schema

Steps can be short form (bare string) or long form (object):
A step must have either run or workflow, but not both.

Environment Variables

Workflows support environment variable expansion using $VAR or ${VAR} syntax:

Variable Precedence

  1. Runtime parameters (highest priority): asc workflow run example VAR:value
  2. Step-level with: {"with": {"VAR": "value"}}
  3. Workflow-level env: {"env": {"VAR": "value"}}
  4. Global env: Top-level env object
  5. Process environment (lowest priority): Inherited from shell

Runtime Parameters

Pass parameters when running a workflow:
Parameters follow the format KEY:VALUE. They override all other variable sources.

Conditional Steps

Use the if field to skip steps when a variable is unset or empty:
Skip the submission step:
Include the submission step:

Calling Other Workflows

Workflows can call other workflows using the workflow field:
Run the parent workflow:
The preflight workflow is called first, with access to the NOTE variable.
Private workflows ("private": true) are hidden from asc workflow list but can be called by other workflows.

Hooks

Workflows support lifecycle hooks at the definition level:

before_all

Runs once before any workflow:
Use for authentication checks, environment validation, or setup tasks.

after_all

Runs once after the workflow completes (success or failure):
Use for cleanup, notifications, or logging.

error

Runs only on workflow failure:
Use for error notifications or rollback logic.
Hooks run via bash (with pipefail) or sh. At least one shell must be in PATH.

Output Format

Workflow output is JSON-only on stdout:
Step and hook command output streams to stderr to keep stdout machine-parseable.

Commands

workflow run

Run a named workflow:
Flags:
  • --file - Path to workflow.json (default: .asc/workflow.json)
  • --dry-run - Preview steps without executing
  • --pretty - Pretty-print JSON output
Example:

workflow list

List available workflows:
Flags:
  • --file - Path to workflow.json
  • --all - Include private workflows
  • --pretty - Pretty-print JSON output
Output:

workflow validate

Validate workflow file for errors and cycles:
Flags:
  • --file - Path to workflow.json
  • --pretty - Pretty-print JSON output
Output:
Or on error:

Security Considerations

Workflows intentionally execute arbitrary shell commands. Only run workflow files you trust.

Best Practices

  • Review workflow files before running them, especially with --file
  • Avoid running workflows from untrusted sources (e.g., unreviewed PRs)
  • Be careful with secrets - steps inherit your process environment
  • In CI, use secret masking - workflows may log environment variables
  • Use workflow validate to check structure, but validation does not check safety

CI/CD Considerations

Avoid running workflows on untrusted pull requests with access to secrets or tokens.

Examples

TestFlight Distribution

Run:

App Store Submission

Run: