Dagger
Search

version-manager

Dagger Version Manager - Automated version synchronization for multi-file projects.

Installation

dagger install github.com/SolomonHD/dagger-version-manager@7d037d40c1d2c325f96571866670554b4b875322

Entrypoint

Return Type
VersionManager !
Example
dagger -m github.com/SolomonHD/dagger-version-manager@7d037d40c1d2c325f96571866670554b4b875322 call \
func (m *MyModule) Example() *dagger.VersionManager  {
	return dag.
			VersionManager()
}
@function
def example() -> dagger.VersionManager:
	return (
		dag.version_manager()
	)
@func()
example(): VersionManager {
	return dag
		.versionManager()
}

Types

VersionManager 🔗

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: source: Source directory (required, use –source=. for your project) bump_type: Type of bump (major, minor, or patch) version_file: Name of the version file (default: VERSION)

Returns: Updated directory with bumped version

Example: dagger call bump-version –source=. –bump-type=patch export –path=. dagger call bump-version –source=. –bump-type=minor export –path=. dagger call bump-version –source=. –bump-type=major export –path=.

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-Source directory containing version file (use --source=. for your project)
bumpTypeString !-Type of version bump: major, minor, or patch
versionFileString !"VERSION"Name of the version file to update
Example
dagger -m github.com/SolomonHD/dagger-version-manager@7d037d40c1d2c325f96571866670554b4b875322 call \
 bump-version --source DIR_PATH --bump-type string --version-file string
func (m *MyModule) Example(source *dagger.Directory, bumpType string, versionFile string) *dagger.Directory  {
	return dag.
			VersionManager().
			BumpVersion(source, bumpType, versionFile)
}
@function
def example(source: dagger.Directory, bump_type: str, version_file: str) -> dagger.Directory:
	return (
		dag.version_manager()
		.bump_version(source, bump_type, version_file)
	)
@func()
example(source: Directory, bumpType: string, versionFile: string): Directory {
	return dag
		.versionManager()
		.bumpVersion(source, bumpType, versionFile)
}

getVersion() 🔗

Read and return the current version from the version file.

Args: source: Source directory (required, use –source=. for your project) version_file: Name of the version file (default: VERSION)

Returns: Version string or error message

Example: dagger call get-version –source=. dagger call get-version –source=. –version-file=MY_VERSION

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-Source directory containing version file (use --source=. for your project)
versionFileString !"VERSION"Name of the version file
Example
dagger -m github.com/SolomonHD/dagger-version-manager@7d037d40c1d2c325f96571866670554b4b875322 call \
 get-version --source DIR_PATH --version-file string
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, versionFile string) string  {
	return dag.
			VersionManager().
			GetVersion(ctx, source, versionFile)
}
@function
async def example(source: dagger.Directory, version_file: str) -> str:
	return await (
		dag.version_manager()
		.get_version(source, version_file)
	)
@func()
async example(source: Directory, versionFile: string): Promise<string> {
	return dag
		.versionManager()
		.getVersion(source, 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 (required, use –source=. for your project) 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 –source=. dagger call release –source=. –tag-message=“Major release with breaking changes”

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-Source directory containing version files (use --source=. for your project)
versionFileString !"VERSION"Name of the source version file
targetFileString !"galaxy.yml"Name of the target file to sync
versionPatternString !"^version:.*$"Regex pattern to match version line in target file
tagMessageString nullCustom git tag message (defaults to 'Release X.Y.Z')
Example
dagger -m github.com/SolomonHD/dagger-version-manager@7d037d40c1d2c325f96571866670554b4b875322 call \
 release --source DIR_PATH --version-file string --target-file string --version-pattern string
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, versionFile string, targetFile string, versionPattern string) string  {
	return dag.
			VersionManager().
			Release(ctx, source, versionFile, targetFile, versionPattern)
}
@function
async def example(source: dagger.Directory, version_file: str, target_file: str, version_pattern: str) -> str:
	return await (
		dag.version_manager()
		.release(source, version_file, target_file, version_pattern)
	)
@func()
async example(source: Directory, versionFile: string, targetFile: string, versionPattern: string): Promise<string> {
	return dag
		.versionManager()
		.release(source, 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 (required, use –source=. for your project)

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
NameTypeDefault ValueDescription
sourceDirectory !-Source directory containing project files (use --source=. for your project)
Example
dagger -m github.com/SolomonHD/dagger-version-manager@7d037d40c1d2c325f96571866670554b4b875322 call \
 setup-git-hooks --source DIR_PATH
func (m *MyModule) Example(source *dagger.Directory) *dagger.Directory  {
	return dag.
			VersionManager().
			SetupGitHooks(source)
}
@function
def example(source: dagger.Directory) -> dagger.Directory:
	return (
		dag.version_manager()
		.setup_git_hooks(source)
	)
@func()
example(source: Directory): Directory {
	return dag
		.versionManager()
		.setupGitHooks(source)
}

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 (required, use –source=. for your project) 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 –source=. export –path=. dagger call sync-version –source=. –target-file=pyproject.toml –version-pattern=’^version\s=\s”.*“’ export –path=.

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-Source directory containing version files (use --source=. for your project)
versionFileString !"VERSION"Name of the source version file
targetFileString !"galaxy.yml"Name of the target file to update
versionPatternString !"^version:.*$"Regex pattern to match version line in target file
Example
dagger -m github.com/SolomonHD/dagger-version-manager@7d037d40c1d2c325f96571866670554b4b875322 call \
 sync-version --source DIR_PATH --version-file string --target-file string --version-pattern string
func (m *MyModule) Example(source *dagger.Directory, versionFile string, targetFile string, versionPattern string) *dagger.Directory  {
	return dag.
			VersionManager().
			SyncVersion(source, versionFile, targetFile, versionPattern)
}
@function
def example(source: dagger.Directory, version_file: str, target_file: str, version_pattern: str) -> dagger.Directory:
	return (
		dag.version_manager()
		.sync_version(source, version_file, target_file, version_pattern)
	)
@func()
example(source: Directory, versionFile: string, targetFile: string, versionPattern: string): Directory {
	return dag
		.versionManager()
		.syncVersion(source, versionFile, targetFile, versionPattern)
}

validateVersion() 🔗

Validate that version in source file matches version in target file.

Args: source: Source directory (required, use –source=. for your project) 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 –source=. dagger call validate-version –source=. –target-file=pyproject.toml –version-pattern=’^version\s=\s”.*“’

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-Source directory containing version files (use --source=. for your project)
versionFileString !"VERSION"Name of the source version file
targetFileString !"galaxy.yml"Name of the target file to validate against
versionPatternString !"^version:.*$"Regex pattern to match version line in target file
Example
dagger -m github.com/SolomonHD/dagger-version-manager@7d037d40c1d2c325f96571866670554b4b875322 call \
 validate-version --source DIR_PATH --version-file string --target-file string --version-pattern string
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, versionFile string, targetFile string, versionPattern string) string  {
	return dag.
			VersionManager().
			ValidateVersion(ctx, source, versionFile, targetFile, versionPattern)
}
@function
async def example(source: dagger.Directory, version_file: str, target_file: str, version_pattern: str) -> str:
	return await (
		dag.version_manager()
		.validate_version(source, version_file, target_file, version_pattern)
	)
@func()
async example(source: Directory, versionFile: string, targetFile: string, versionPattern: string): Promise<string> {
	return dag
		.versionManager()
		.validateVersion(source, versionFile, targetFile, versionPattern)
}