@@ -416,6 +416,12 @@ def prepare_build_env(self, version: semver.Version, datetime_tag: str) -> list[
416416
417417 base_image = f"{ self .registry } /{ self .image_name } "
418418
419+ # Create version string with dev suffix for local builds
420+ version_str = str (version )
421+ if self .dev_mode or not is_ci :
422+ # Add dev suffix with short commit hash
423+ version_str = f"{ version } -dev.{ commit [:7 ]} " if commit != "unknown" else f"{ version } -dev"
424+
419425 # Prepare tags based on environment
420426 tags = []
421427 if self .dev_mode or not is_ci :
@@ -424,9 +430,9 @@ def prepare_build_env(self, version: semver.Version, datetime_tag: str) -> list[
424430 tags = [
425431 f"{ base_image } :dev" ,
426432 f"{ base_image } :dev-{ dev_timestamp } " ,
427- f"{ base_image } :{ version } -dev " ,
433+ f"{ base_image } :{ version_str } " ,
428434 ]
429- console .print ("[yellow]📦 Development mode - building for local testing [/yellow]" )
435+ console .print (f "[yellow]📦 Development mode - version: { version_str } [/yellow]" )
430436 else :
431437 # Production build
432438 tags = [
@@ -445,7 +451,7 @@ def prepare_build_env(self, version: semver.Version, datetime_tag: str) -> list[
445451 "IMAGE_TAG" : tags [0 ],
446452 "PLATFORMS" : self .platforms ,
447453 "DOCKERFILE" : self .dockerfile ,
448- "VERSION" : str ( version ) ,
454+ "VERSION" : version_str ,
449455 "BUILD_DATE" : datetime .now ().isoformat (),
450456 "GIT_COMMIT" : commit ,
451457 "GIT_BRANCH" : branch ,
@@ -526,11 +532,14 @@ def create_git_tag(self, version: semver.Version):
526532 console .print ("[green]✓[/green] Pushed tag to remote" )
527533
528534 def write_tag_files (self , version : semver .Version , datetime_tag : str , tags : list [str ]):
529- """Write tag information to files"""
535+ """Write tag information to files for reference """
530536 console .print ("[blue]Writing tag information to files...[/blue]" )
531537
532538 Path (".latest-image-tag" ).write_text (f"{ datetime_tag } \n " )
533- Path (".latest-semver" ).write_text (f"{ version } \n " )
539+
540+ # Use the version string from env_vars which includes dev suffix if applicable
541+ version_str = self .env_vars .get ("VERSION" , str (version ))
542+ Path (".latest-semver" ).write_text (f"{ version_str } \n " )
534543
535544 # Write first tag as the main registry image
536545 if tags :
@@ -543,7 +552,7 @@ def write_tag_files(self, version: semver.Version, datetime_tag: str, tags: list
543552 Path (".env.build" ).write_text ("\n " .join (env_content ) + "\n " )
544553
545554 console .print (f" → .latest-image-tag: { datetime_tag } " )
546- console .print (f" → .latest-semver: { version } " )
555+ console .print (f" → .latest-semver: { version_str } " )
547556 console .print (f" → .latest-registry-image: { tags [0 ] if tags else 'N/A' } " )
548557 console .print (" → .env.build: Build environment saved" )
549558
@@ -555,13 +564,16 @@ def print_summary(self, version: semver.Version, datetime_tag: str, tags: list[s
555564 table .add_column ("Property" , style = "cyan" )
556565 table .add_column ("Value" , style = "green" )
557566
567+ # Get version string with dev suffix if applicable
568+ version_str = self .env_vars .get ("VERSION" , str (version ))
569+
558570 table .add_row ("Build System" , "Docker Compose" )
559571 table .add_row ("Compose File" , self .compose_file )
560572 table .add_row ("Image Name" , self .image_name )
561573 table .add_row ("Registry" , self .registry )
562574 table .add_row ("Build Mode" , "Development" if self .dev_mode else "Production" )
563575 table .add_row ("Build Type" , "CI/CD" if is_ci else "Local" )
564- table .add_row ("Semantic Version" , str ( version ) )
576+ table .add_row ("Semantic Version" , version_str )
565577 table .add_row ("DateTime Tag" , datetime_tag )
566578 table .add_row ("Platforms" , self .platforms )
567579 table .add_row ("Tags Created" , str (len (tags )))
@@ -708,7 +720,14 @@ def main(
708720 console .print ("[blue]No existing version found, starting at 1.0.0[/blue]" )
709721
710722 version = builder .bump_version (current_version , version_bump )
711- console .print (f"[blue]New version ({ version_bump } bump): { version } [/blue]" )
723+ if dev_mode :
724+ commit , _ = builder .get_git_info ()
725+ version_display = (
726+ f"{ version } -dev.{ commit [:7 ]} " if commit != "unknown" else f"{ version } -dev"
727+ )
728+ console .print (f"[blue]New version ({ version_bump } bump): { version_display } [/blue]" )
729+ else :
730+ console .print (f"[blue]New version ({ version_bump } bump): { version } [/blue]" )
712731
713732 # Generate datetime tag
714733 datetime_tag = datetime .now ().strftime ("%y%m%d%H%M" )
@@ -719,8 +738,9 @@ def main(
719738 # Build and push with Docker Compose
720739 tags = builder .build_and_push_with_compose (version , datetime_tag , tags )
721740
722- # Create git tag
723- if not skip_push and not dev_mode :
741+ # Create git tag (only for production builds)
742+ is_ci = os .environ .get ("CI" ) or os .environ .get ("GITHUB_ACTIONS" )
743+ if not skip_push and not dev_mode and is_ci :
724744 builder .create_git_tag (version )
725745
726746 # Write tag files
0 commit comments