Skip to content

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

  1. Single responsibility principle
  2. Clear input/output contract
  3. Error handling
  4. Comprehensive tests

Flow Workflows

  1. Combine core actions
  2. Handle workflow state
  3. Provide higher-level operations
  4. Error recovery

Best Practices

  1. Workflow Selection

    • Use core actions for atomic operations
    • Use flows for complex processes
    • Keep responsibilities clear
  2. Version Management

    • Tag releases appropriately
    • Reference specific versions
    • Document breaking changes
  3. Error Handling

    • Provide clear error messages
    • Handle failure states
    • Document error conditions
  4. Testing

    • Test all workflows
    • Include error cases
    • Verify outputs