dagger-version-manager
Dagger Version Manager - Automated version synchronization for multi-file projects.
Installation
dagger install github.com/SolomonHD/dagger-version-manager@v1.0.1Entrypoint
Return Type
DaggerVersionManager ! Example
dagger -m github.com/SolomonHD/dagger-version-manager@8b982aea08a2197632f39a26b4952b0f201e90c8 call \
func (m *MyModule) Example() *dagger.DaggerVersionManager {
return dag.
DaggerVersionManager()
}@function
def example() -> dagger.DaggerVersionManager:
return (
dag.dagger_version_manager()
)@func()
example(): DaggerVersionManager {
return dag
.daggerVersionManager()
}Types
DaggerVersionManager 🔗
Dagger module for managing semantic versions across multiple configuration files. Provides version synchronization, validation, bumping, and release workflows for projects that maintain version numbers in multiple files (e.g., VERSION + galaxy.yml).
bumpVersion() 🔗
Increment version according to semantic versioning rules.
- major: X.Y.Z → (X+1).0.0
- minor: X.Y.Z → X.(Y+1).0
- patch: X.Y.Z → X.Y.(Z+1)
Args: bump_type: Type of bump (major, minor, or patch) source: Source directory (defaults to current module source) version_file: Name of the version file (default: VERSION)
Returns: Updated directory with bumped version
Example: dagger call bump-version –bump-type=patch export –path=. dagger call bump-version –bump-type=minor export –path=. dagger call bump-version –bump-type=major export –path=.
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| bumpType | String ! | - | Type of version bump: major, minor, or patch |
| source | Directory | null | Source directory containing version file (defaults to current module) |
| versionFile | String ! | "VERSION" | Name of the version file to update |
Example
dagger -m github.com/SolomonHD/dagger-version-manager@8b982aea08a2197632f39a26b4952b0f201e90c8 call \
bump-version --bump-type string --version-file stringfunc (m *MyModule) Example(bumpType string, versionFile string) *dagger.Directory {
return dag.
DaggerVersionManager().
BumpVersion(bumpType, versionFile)
}@function
def example(bump_type: str, version_file: str) -> dagger.Directory:
return (
dag.dagger_version_manager()
.bump_version(bump_type, version_file)
)@func()
example(bumpType: string, versionFile: string): Directory {
return dag
.daggerVersionManager()
.bumpVersion(bumpType, versionFile)
}getVersion() 🔗
Read and return the current version from the version file.
Args: source: Source directory (defaults to current module source) version_file: Name of the version file (default: VERSION)
Returns: Version string or error message
Example: dagger call get-version dagger call get-version –version-file=MY_VERSION
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | null | Source directory containing version file (defaults to current module) |
| versionFile | String ! | "VERSION" | Name of the version file |
Example
dagger -m github.com/SolomonHD/dagger-version-manager@8b982aea08a2197632f39a26b4952b0f201e90c8 call \
get-version --version-file stringfunc (m *MyModule) Example(ctx context.Context, versionFile string) string {
return dag.
DaggerVersionManager().
GetVersion(ctxversionFile)
}@function
async def example(version_file: str) -> str:
return await (
dag.dagger_version_manager()
.get_version(version_file)
)@func()
async example(versionFile: string): Promise<string> {
return dag
.daggerVersionManager()
.getVersion(versionFile)
}release() 🔗
Complete release workflow: sync version, validate, and generate git commands.
This function orchestrates the release process by: 1. Syncing version from source to target file 2. Validating consistency 3. Generating git commands for manual execution
Args: source: Source directory (defaults to current module source) version_file: Name of the source version file (default: VERSION) target_file: Name of the target file to sync (default: galaxy.yml) version_pattern: Regex pattern to match version line tag_message: Custom git tag message (optional)
Returns: Release instructions with git commands
Example: dagger call release dagger call release –tag-message=“Major release with breaking changes”
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | null | Source directory containing version files (defaults to current module) |
| versionFile | String ! | "VERSION" | Name of the source version file |
| targetFile | String ! | "galaxy.yml" | Name of the target file to sync |
| versionPattern | String ! | "^version:.*$" | Regex pattern to match version line in target file |
| tagMessage | String | null | Custom git tag message (defaults to 'Release X.Y.Z') |
Example
dagger -m github.com/SolomonHD/dagger-version-manager@8b982aea08a2197632f39a26b4952b0f201e90c8 call \
release --version-file string --target-file string --version-pattern stringfunc (m *MyModule) Example(ctx context.Context, versionFile string, targetFile string, versionPattern string) string {
return dag.
DaggerVersionManager().
Release(ctxversionFile, targetFile, versionPattern)
}@function
async def example(version_file: str, target_file: str, version_pattern: str) -> str:
return await (
dag.dagger_version_manager()
.release(version_file, target_file, version_pattern)
)@func()
async example(versionFile: string, targetFile: string, versionPattern: string): Promise<string> {
return dag
.daggerVersionManager()
.release(versionFile, targetFile, versionPattern)
}setupGitHooks() 🔗
Install git hooks for automated version validation.
This function sets up pre-commit and pre-push hooks that enforce version consistency across project files. The hooks are automatically configured based on detected project type (Ansible, Python, Docker, or Helm).
The hooks will: - Block commits/pushes if versions are inconsistent - Display helpful error messages - Suggest sync commands to fix issues
Args: source: Source directory (defaults to current module source)
Returns: Updated directory with git hooks installed
Raises: Exception: If .git directory not found or project type cannot be detected
Example: dagger call setup-git-hooks –source=. export –path=.
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | null | Source directory containing project files (defaults to current module) |
Example
dagger -m github.com/SolomonHD/dagger-version-manager@8b982aea08a2197632f39a26b4952b0f201e90c8 call \
setup-git-hooksfunc (m *MyModule) Example() *dagger.Directory {
return dag.
DaggerVersionManager().
SetupGitHooks()
}@function
def example() -> dagger.Directory:
return (
dag.dagger_version_manager()
.setup_git_hooks()
)@func()
example(): Directory {
return dag
.daggerVersionManager()
.setupGitHooks()
}syncVersion() 🔗
Synchronize version from source file to target file.
Reads version from source file and updates the matching line in target file according to the specified pattern.
Args: source: Source directory (defaults to current module source) version_file: Name of the source version file (default: VERSION) target_file: Name of the target file to update (default: galaxy.yml) version_pattern: Regex pattern to match version line (default: r’^version:.*$‘)
Returns: Updated directory with synced version
Example: dagger call sync-version export –path=. dagger call sync-version –target-file=pyproject.toml –version-pattern=’^version\s=\s”.*“’ export –path=.
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | null | Source directory containing version files (defaults to current module) |
| versionFile | String ! | "VERSION" | Name of the source version file |
| targetFile | String ! | "galaxy.yml" | Name of the target file to update |
| versionPattern | String ! | "^version:.*$" | Regex pattern to match version line in target file |
Example
dagger -m github.com/SolomonHD/dagger-version-manager@8b982aea08a2197632f39a26b4952b0f201e90c8 call \
sync-version --version-file string --target-file string --version-pattern stringfunc (m *MyModule) Example(versionFile string, targetFile string, versionPattern string) *dagger.Directory {
return dag.
DaggerVersionManager().
SyncVersion(versionFile, targetFile, versionPattern)
}@function
def example(version_file: str, target_file: str, version_pattern: str) -> dagger.Directory:
return (
dag.dagger_version_manager()
.sync_version(version_file, target_file, version_pattern)
)@func()
example(versionFile: string, targetFile: string, versionPattern: string): Directory {
return dag
.daggerVersionManager()
.syncVersion(versionFile, targetFile, versionPattern)
}validateVersion() 🔗
Validate that version in source file matches version in target file.
Args: source: Source directory (defaults to current module source) version_file: Name of the source version file (default: VERSION) target_file: Name of the target file to check (default: galaxy.yml) version_pattern: Regex pattern to match version line (default: r’^version:.*$‘)
Returns: Validation result message
Example: dagger call validate-version dagger call validate-version –target-file=pyproject.toml –version-pattern=’^version\s=\s”.*“’
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | null | Source directory containing version files (defaults to current module) |
| versionFile | String ! | "VERSION" | Name of the source version file |
| targetFile | String ! | "galaxy.yml" | Name of the target file to validate against |
| versionPattern | String ! | "^version:.*$" | Regex pattern to match version line in target file |
Example
dagger -m github.com/SolomonHD/dagger-version-manager@8b982aea08a2197632f39a26b4952b0f201e90c8 call \
validate-version --version-file string --target-file string --version-pattern stringfunc (m *MyModule) Example(ctx context.Context, versionFile string, targetFile string, versionPattern string) string {
return dag.
DaggerVersionManager().
ValidateVersion(ctxversionFile, targetFile, versionPattern)
}@function
async def example(version_file: str, target_file: str, version_pattern: str) -> str:
return await (
dag.dagger_version_manager()
.validate_version(version_file, target_file, version_pattern)
)@func()
async example(versionFile: string, targetFile: string, versionPattern: string): Promise<string> {
return dag
.daggerVersionManager()
.validateVersion(versionFile, targetFile, versionPattern)
}