Intelligently determines the correct deployment directory based on repository structure and configuration.
- 🔍 Auto-detection - Finds deployment directories
- 📁 Multi-structure support - Monorepo and single-repo
- 🎯 Path resolution - Handles various path patterns
- ✅ Validation - Ensures directories exist
- 🔄 Fallback logic - Smart defaults
- name: Determine deployment directory
uses: skyhook-io/determine-deploy-dir@v1
id: deploy-dir
with:
environment: production
service_dir: services/backend| Input | Description | Required | Default |
|---|---|---|---|
environment |
Environment/overlay name | ✅ | - |
service_dir |
Service directory | ❌ | . |
deployment_repo |
Deployment repository (if different from current) | ❌ | - |
deployment_path |
Path in deployment repository | ❌ | - |
current_repo |
Current repository | ❌ | ${{ github.repository }} |
| Output | Description | Example |
|---|---|---|
deploy_dir |
Full path to deployment overlay directory | services/api/deploy/overlays/prod |
is_custom_path |
Whether using custom deployment path | false |
base_dir |
Base directory before overlay path | services/api |
The action constructs the deployment directory path based on inputs:
- If
deployment_pathis provided and different from service_dir:{deployment_path}/deploy/overlays/{environment} - If
service_diris provided and not '.':{service_dir}/deploy/overlays/{environment} - Default:
deploy/overlays/{environment}
When deployment_repo differs from current_repo, the action sets is_custom_path to true.
- name: Find deploy directory
uses: skyhook-io/determine-deploy-dir@v1
id: dir
with:
environment: production
service_dir: services/backend
- name: Use directory
run: |
echo "Deploying from: ${{ steps.dir.outputs.deploy_dir }}"
kustomize build ${{ steps.dir.outputs.deploy_dir }}- name: Find deploy directory
uses: skyhook-io/determine-deploy-dir@v1
id: dir
with:
environment: staging
# service_dir defaults to '.', will find deploy/overlays/staging- name: Find deploy directory
uses: skyhook-io/determine-deploy-dir@v1
id: dir
with:
environment: ${{ inputs.env }}
service_dir: services/${{ matrix.service }}- name: Find deploy directory
uses: skyhook-io/determine-deploy-dir@v1
id: dir
with:
environment: production
deployment_path: ${{ inputs.path }}
- name: Check if custom path
if: steps.dir.outputs.is_custom_path == 'true'
run: |
echo "Using custom deployment path"jobs:
deploy:
steps:
- uses: actions/checkout@v4
- name: Determine deployment directory
uses: skyhook-io/determine-deploy-dir@v1
id: deploy-dir
with:
environment: ${{ inputs.environment }}
service_dir: ${{ inputs.service_dir }}
deployment_path: ${{ inputs.deployment_path }}
- name: Update manifests
uses: skyhook-io/kustomize-edit@v1
with:
overlay_dir: ${{ steps.deploy-dir.outputs.deploy_dir }}
image: ${{ inputs.service }}
tag: ${{ inputs.tag }}
- name: Deploy
uses: skyhook-io/kustomize-apply@v1
with:
overlay_dir: ${{ steps.deploy-dir.outputs.deploy_dir }}repo/
├── services/
│ ├── api/
│ │ └── deploy/
│ │ └── overlays/
│ │ ├── dev/
│ │ └── prod/
│ └── web/
│ └── deploy/
│ └── overlays/
│ ├── dev/
│ └── prod/
repo/
├── src/
├── deploy/
│ ├── base/
│ └── overlays/
│ ├── staging/
│ └── production/
repo/
├── src/
├── k8s/
│ ├── base/
│ └── overlays/
│ ├── dev/
│ └── prod/
- Searches multiple common patterns
- Validates kustomization.yaml exists
- Provides clear error messages
- Handles nested monorepo structures
- Works with various naming conventions