name: conditional-deployment
mode: standard
commands:
- shell: "cargo test --quiet 2>/dev/null && echo true || echo false"
capture: "tests_passed"
capture_format: boolean
allow_failure: true
- shell: "cargo test 2>&1 | grep -E 'test result:' | grep -oE '[0-9]+ passed' | cut -d' ' -f1 || echo 0"
capture: "test_count"
capture_format: number
allow_failure: true
- shell: "echo 'Running coverage analysis...'"
when: "${tests_passed}"
capture: "coverage_status"
- shell: "grep '^version' Cargo.toml | cut -d'\"' -f2 || echo '0.0.0'"
capture: "current_version"
- shell: |
if [ "${test_count}" -gt "10" ]; then
echo "true"
else
echo "false"
fi
capture: "should_bump"
capture_format: boolean
- shell: "echo 'Would bump version from ${current_version}'"
when: "${should_bump}"
- shell: "cargo build --release"
when: "${tests_passed}"
capture: "build_output"
capture_streams:
stdout: true
stderr: true
exit_code: true
success: true
- shell: |
cat << EOF
Deployment Summary
==================
Tests Passed: ${tests_passed}
Test Count: ${test_count}
Current Version: ${current_version}
Version Bumped: ${should_bump}
Build Success: ${build_output.success|default:false}
Build Exit Code: ${build_output.exit_code|default:N/A}
EOF
capture: "deployment_summary"
- shell: "echo '${deployment_summary}' > deployment-summary.txt"
- shell: |
if [ "${tests_passed}" = "true" ] && [ "${build_output.success|default:false}" = "true" ]; then
echo "✅ Deployment ready!"
else
echo "❌ Deployment blocked - check summary"
fi