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..."
name: Deferred Steps Example
jobs:
test:
aliases: [default]
steps:
- defer:
run: 'echo "Cleanup: stopping services..."'
- run: echo "Starting services..."
- run: echo "Running tests..."
- run: echo "Tests complete!"
name: For Loop Steps Example
vars:
environments:
- dev
- staging
- prod
tasks:
deploy_all:
aliases: [default]
desc: Deploy to all environments
steps:
- for: env in environments
task: deploy_service
deploy_service:
requires: [env]
steps:
- run: echo "Deploying to ${{ env }} environment..."

See Loops for advanced loop patterns.
See Also
- Pipelines - Pipeline-level configuration
- Jobs - Job configuration and dependencies
- Loops - For loop details
- Conditionals - Conditional execution