Steps

Steps are the individual commands or actions within a job. They execute sequentially by default.

Step Fields

Field Description
run: Shell command to execute
cmd: Alias for run:
cmds: List of commands (run sequentially)
task: Invoke another job/task by name
name: Display name for the step
if: Conditional execution
for: Loop iteration (for: item in collection )
dir: Working directory
detach: true Run step in background
deferred: true Run after other steps complete
defer: Shorthand for a deferred step
verbose: true Show more output
passthru: true Output with tree indentation
tty: true Allocate a PTY for color output
interactive: true Live streaming with stdin
vars: Step-level variables
env: Step-level environment variables

Examples

  name: Basic Steps Example

jobs:
  setup:
    steps:
      - name: Install dependencies
        run: echo "Installing dependencies..."
      - name: Run migrations
        run: echo "Running migrations..."
      - name: Start server
        run: echo "Starting server..."
        detach: true

  default:
    steps:
      - task: lint
      - task: build
      - task: test

  lint:
    steps:
      - run: echo "Running linter..."

  build:
    steps:
      - run: echo "Building..."

  test:
    steps:
      - run: echo "Testing..."

See Loops for advanced loop patterns.

See Also