English | 🇯🇵 日本語
A comprehensive GitHub Actions automation toolkit for multi-service deployment orchestration with Terragrunt and Kubernetes.
Deploy Actions provides a complete solution for automating deployments across multiple services and environments. It combines intelligent change detection, configuration validation, and deployment orchestration to streamline CI/CD workflows for complex multi-service architectures.
- Intelligent Change Detection: Automatically detects changed services from file modifications
- Configuration Management: Validates and manages deployment configurations
- Deployment Resolution: Converts PR labels to deployment targets
- Multi-Stack Support: Supports Terragrunt and Kubernetes deployments
- Security-First: Built-in safety checks and IAM role management
- Matrix Generation: Creates deployment matrices for parallel execution
The toolkit consists of three main components:
Validates and manages workflow configuration files that define deployment environments, services, and automation rules.
Key Features:
- Configuration validation with detailed error reporting
- Environment and service management
- Directory convention validation
- Template generation
Analyzes file changes and automatically creates deployment labels for modified services.
Key Features:
- Change detection from git diff
- Service discovery from directory patterns
- Automatic label generation
- Exclusion handling
Converts PR labels and branch information into deployment targets for GitHub Actions automation.
Key Features:
- Label-to-target resolution
- Environment detection from branches
- Deployment matrix generation
- Safety validation
The toolkit provides ready-to-use composite actions:
- uses: panicboat/deploy-actions/label-dispatcher@main
with:
pr-number: ${{ github.event.pull_request.number }}
repository: ${{ github.repository }}
github-token: ${{ secrets.GITHUB_TOKEN }}- uses: panicboat/deploy-actions/label-resolver@main
with:
action-type: plan # or apply
pr-number: ${{ github.event.pull_request.number }}
repository: ${{ github.repository }}
github-token: ${{ secrets.GITHUB_TOKEN }}- uses: panicboat/deploy-actions/apply-terragrunt@main
with:
deployment-targets: ${{ steps.resolve.outputs.deployment-targets }}
action-type: plan # or apply
github-token: ${{ secrets.GITHUB_TOKEN }}The toolkit uses a centralized workflow-config.yaml file:
# Environment configurations
environments:
- environment: develop
aws_region: ap-northeast-1
iam_role_plan: arn:aws:iam::ACCOUNT:role/plan-role
iam_role_apply: arn:aws:iam::ACCOUNT:role/apply-role
- environment: staging
aws_region: ap-northeast-1
iam_role_plan: arn:aws:iam::ACCOUNT:role/staging-plan-role
iam_role_apply: arn:aws:iam::ACCOUNT:role/staging-apply-role
- environment: production
aws_region: ap-northeast-1
iam_role_plan: arn:aws:iam::ACCOUNT:role/production-plan-role
iam_role_apply: arn:aws:iam::ACCOUNT:role/production-apply-role
# Directory structure conventions
directory_conventions:
- root: "{service}"
stacks:
- name: terragrunt
directory: "terragrunt/{environment}"
- name: kubernetes
directory: "kubernetes/overlays/{environment}"
# Service-specific configurations
services:
- name: excluded-service
exclude_from_automation: true
exclusion_config:
reason: "Manual deployment required"
type: "permanent"
# Branch-to-environment mapping
branch_patterns:
develop: develop
staging: staging
production: productionThe toolkit supports flexible directory structures:
directory_conventions:
- root: "{service}"
stacks:
- name: terragrunt
directory: "terragrunt/{environment}"
- name: kubernetes
directory: "kubernetes/overlays/{environment}"Results in:
my-service/terragrunt/develop/my-service/kubernetes/overlays/develop/
directory_conventions:
- root: ""
stacks:
- name: terragrunt
directory: "terragrunt/{service}/{environment}"
- name: kubernetes
directory: "kubernetes/{service}/overlays/{environment}"Results in:
terragrunt/my-service/develop/kubernetes/my-service/overlays/develop/
directory_conventions:
- root: "apps/web/{service}"
stacks:
- name: terragrunt
directory: "terragrunt/{environment}"
- root: "services/{service}"
stacks:
- name: terragrunt
directory: "terragrunt/{environment}"
- name: kubernetes
directory: "kubernetes/overlays/{environment}"Results in:
apps/web/my-service/terragrunt/develop/services/my-service/terragrunt/develop/services/my-service/kubernetes/overlays/develop/
name: Detect Changes and Create Labels
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
detect-changes:
runs-on: ubuntu-latest
steps:
- name: Dispatch Labels
uses: panicboat/deploy-actions/label-dispatcher@main
with:
pr-number: ${{ github.event.pull_request.number }}
repository: ${{ github.repository }}
github-token: ${{ secrets.GITHUB_TOKEN }}name: Deploy Infrastructure
on:
pull_request:
types: [labeled]
jobs:
plan:
runs-on: ubuntu-latest
if: contains(github.event.label.name, 'deploy:')
steps:
- name: Resolve Deployment Targets
id: resolve
uses: panicboat/deploy-actions/label-resolver@main
with:
action-type: plan
pr-number: ${{ github.event.pull_request.number }}
repository: ${{ github.repository }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy with Terragrunt
uses: panicboat/deploy-actions/apply-terragrunt@main
with:
deployment-targets: ${{ steps.resolve.outputs.deployment-targets }}
action-type: plan
github-token: ${{ secrets.GITHUB_TOKEN }}GITHUB_TOKEN: GitHub API access tokenGITHUB_REPOSITORY: Repository name (owner/repo format)
WORKFLOW_CONFIG_PATH: Path to configuration file (default:workflow-config.yaml)SOURCE_REPO_PATH: Path to source repository checkoutGITHUB_ACTIONS: Enables GitHub Actions output formatGITHUB_REF_NAME: Current branch name
- Ruby 3.4+
- Bundler
- Git
# Clone the repository
git clone https://github.com/panicboat/deploy-actions.git
cd deploy-actions
# Install dependencies
bundle install
# Run tests
bundle exec rspec# Test config manager
bundle exec ruby config-manager/bin/config-manager validate
# Test label dispatcher
bundle exec ruby label-dispatcher/bin/dispatcher detect
# Test Label Resolver
bundle exec ruby label-resolver/bin/resolver resolve PR_NUMBER- IAM Role Integration: Secure AWS credentials management
- PR-based Deployment: Deployments only triggered from valid PRs
- Branch Validation: Environment-specific branch restrictions
- Configuration Validation: Comprehensive safety checks
- Audit Trail: Detailed logging for all deployment decisions
The toolkit provides comprehensive error handling:
- Configuration Errors: Detailed validation messages
- API Failures: Retry logic with exponential backoff
- Permission Issues: Clear IAM role guidance
- Network Issues: Graceful degradation
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run the test suite
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- Check the documentation for detailed component information
- Open an issue on GitHub
- Review the example workflows in the repository