Workflows Overview
Structure
.github/workflows/
├── core.action.*.yml # Atomic, reusable workflows
├── flow.*.yml # Higher-level flows combining actions/workflows
└── test.*.yml # Test workflows for actions/flows
Naming Convention
Core Action Workflows
- Pattern:
core.action.<name>.yml
- Purpose: Atomic, reusable operations
- Example:
core.action.version_calculator.yml
Flow Workflows
- Pattern:
flow.<name>.yml
- Purpose: Combine core actions into higher-level operations
- Example:
flow.prepare_release.yml
Test Workflows
- Pattern:
test.<type>.<name>.yml
- Purpose: Validate actions and flows
- Example:
test.core.action.version_calculator.yml
Implemented Workflows
Core Action Workflows
Version Calculator
- Calculates next version based on Git tags
- Provides current version, next version, and commit count
- Used for automated version management
Version Updater
- Updates version numbers across multiple files
- Supports YAML, JSON, and text files
- Maintains file formatting and structure
Flow Workflows
Prepare Release
- Combines version calculation and updating
- Manages release preparation process
- Creates release branches and PRs
Test Workflows
Version Calculator Tests
- Validates version calculation logic
- Tests with and without existing tags
- Verifies output format and error handling
Version Updater Tests
- Tests file updates across formats
- Validates prefix handling
- Verifies error conditions
Usage Patterns
Using Core Action Workflows
jobs:
calculate:
uses: deepworks-net/github.toolkit/.github/workflows/core.action.version_calculator.yml@v1
Using Flow Workflows
jobs:
prepare:
uses: deepworks-net/github.toolkit/.github/workflows/flow.prepare_release.yml@v1
Implementation Guidelines
Core Action Workflows
- Single responsibility principle
- Clear input/output contract
- Error handling
- Comprehensive tests
Flow Workflows
- Combine core actions
- Handle workflow state
- Provide higher-level operations
- Error recovery
Best Practices
-
Workflow Selection
- Use core actions for atomic operations
- Use flows for complex processes
- Keep responsibilities clear
-
Version Management
- Tag releases appropriately
- Reference specific versions
- Document breaking changes
-
Error Handling
- Provide clear error messages
- Handle failure states
- Document error conditions
-
Testing
- Test all workflows
- Include error cases
- Verify outputs