[GH-ISSUE #581] feat: Add workflow command for multi-step automation sequences #157

Closed
opened 2026-02-26 21:33:50 +03:00 by kerem · 0 comments
Owner

Originally created by @mithileshchellappan on GitHub (Feb 16, 2026).
Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/581

Summary

Add a workflow command that lets users define named, multi-step automation sequences in .asc/workflow.json. Instead of remembering a sequence of asc and shell commands, users run asc workflow run beta.

This is similar to Fastlane lanes or GitHub Actions workflows — composing existing asc commands and arbitrary shell commands with support for environment variables, conditionals, hooks, sub-workflow calls, dry-run preview, and validation.

Example

{
  "env": { "APP_ID": "com.example.myapp" },
  "before_all": "echo 'Starting...'",
  "after_all": "echo 'Done!'",
  "workflows": {
    "beta": {
      "description": "Build and distribute to TestFlight",
      "steps": [
        "echo 'Starting beta for $APP_ID'",
        { "run": "asc publish upload --app $APP_ID --file build/MyApp.ipa", "name": "Upload" },
        { "run": "asc testflight submit --app $APP_ID", "if": "SUBMIT_BETA" },
        { "workflow": "notify", "with": { "MESSAGE": "Beta uploaded!" } }
      ]
    },
    "notify": {
      "private": true,
      "steps": ["curl -X POST $SLACK_WEBHOOK -d '{\"text\": \"$MESSAGE\"}'"]
    }
  }
}

Commands

  • asc workflow run <name> [KEY:VALUE ...] [--dry-run] [--file path]
  • asc workflow validate [--file path]
  • asc workflow list [--file path]

Features

  • Env merging: global → workflow → CLI params, with $VAR / ${VAR} expansion
  • Conditionals: "if": "VAR_NAME" skips step when variable is falsy
  • Sub-workflows: "workflow": "name" with with: env passing, cycle detection, max depth 16
  • Private workflows: callable only as sub-workflows, not directly from CLI
  • Hooks: before_all, after_all, error at the definition level
  • Dry-run: --dry-run previews expanded commands without executing
  • Validation: detects missing steps, invalid names, dangling refs, cycles — all errors reported as structured JSON
  • JSON output: all commands output structured JSON (--pretty for indentation)

Architecture

  • internal/workflow/ — core library with zero codebase imports (stdlib only), immediately extractable to its own module
  • internal/cli/workflow/ — thin CLI adapter using only 3 symbols from shared
  • All asc commands run as shell subprocesses (sh -c), never as Go function calls

Test Coverage

  • 55+ unit tests (validation, env helpers, execution engine)
  • 16 CLI integration tests (cmdtest)
Originally created by @mithileshchellappan on GitHub (Feb 16, 2026). Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/581 ## Summary Add a `workflow` command that lets users define named, multi-step automation sequences in `.asc/workflow.json`. Instead of remembering a sequence of `asc` and shell commands, users run `asc workflow run beta`. This is similar to Fastlane lanes or GitHub Actions workflows — composing existing `asc` commands and arbitrary shell commands with support for environment variables, conditionals, hooks, sub-workflow calls, dry-run preview, and validation. ## Example ```json { "env": { "APP_ID": "com.example.myapp" }, "before_all": "echo 'Starting...'", "after_all": "echo 'Done!'", "workflows": { "beta": { "description": "Build and distribute to TestFlight", "steps": [ "echo 'Starting beta for $APP_ID'", { "run": "asc publish upload --app $APP_ID --file build/MyApp.ipa", "name": "Upload" }, { "run": "asc testflight submit --app $APP_ID", "if": "SUBMIT_BETA" }, { "workflow": "notify", "with": { "MESSAGE": "Beta uploaded!" } } ] }, "notify": { "private": true, "steps": ["curl -X POST $SLACK_WEBHOOK -d '{\"text\": \"$MESSAGE\"}'"] } } } ``` ## Commands - `asc workflow run <name> [KEY:VALUE ...] [--dry-run] [--file path]` - `asc workflow validate [--file path]` - `asc workflow list [--file path]` ## Features - **Env merging**: global → workflow → CLI params, with `$VAR` / `${VAR}` expansion - **Conditionals**: `"if": "VAR_NAME"` skips step when variable is falsy - **Sub-workflows**: `"workflow": "name"` with `with:` env passing, cycle detection, max depth 16 - **Private workflows**: callable only as sub-workflows, not directly from CLI - **Hooks**: `before_all`, `after_all`, `error` at the definition level - **Dry-run**: `--dry-run` previews expanded commands without executing - **Validation**: detects missing steps, invalid names, dangling refs, cycles — all errors reported as structured JSON - **JSON output**: all commands output structured JSON (`--pretty` for indentation) ## Architecture - `internal/workflow/` — core library with **zero codebase imports** (stdlib only), immediately extractable to its own module - `internal/cli/workflow/` — thin CLI adapter using only 3 symbols from `shared` - All `asc` commands run as shell subprocesses (`sh -c`), never as Go function calls ## Test Coverage - 55+ unit tests (validation, env helpers, execution engine) - 16 CLI integration tests (cmdtest)
kerem closed this issue 2026-02-26 21:33:50 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/App-Store-Connect-CLI#157
No description provided.