Skip to content

Add bundle release date command options#3072

Open
lcawl wants to merge 2 commits intobundle-release-datefrom
bundle-release-date-options
Open

Add bundle release date command options#3072
lcawl wants to merge 2 commits intobundle-release-datefrom
bundle-release-date-options

Conversation

@lcawl
Copy link
Copy Markdown
Member

@lcawl lcawl commented Apr 10, 2026

Relates to #3030
This PR is a follow-up to #3066

Overview

This PR implements comprehensive release date automation for changelog bundles, focusing on CI/CD workflows while maintaining flexibility for different use cases. The feature allows release dates to be automatically populated and conditionally rendered based on configuration.

Key Features

🚀 Automatic Release Date Population

  • Auto-population: Bundles automatically get today's date (UTC) when no explicit date is provided
  • GitHub Integration: changelog gh-release automatically uses the GitHub release published_at date
  • CLI Override: --release-date YYYY-MM-DD flag for explicit date specification
  • Preservation: Existing release dates in bundle YAML files are preserved during re-bundling

🎛️ Configurable Rendering Control

  • Bundle-level control: bundle.show_release_dates configuration (defaults to false)
  • Profile-level override: bundle.profiles.<name>.show_release_dates for per-profile customization
  • Conditional rendering: Release dates only appear in output when both enabled and present
  • CLI flag: --no-release-date to explicitly suppress date population

🔧 Profile Mode Enhancement

  • Seamless integration: Profile and option modes of changelog bundle behave identically
  • Configuration inheritance: Profiles inherit bundle-level show_release_dates setting
  • No manual editing: Eliminates need to manually update config files before releases

Major Files Changed

Configuration & Domain Models

  • BundleConfiguration.cs - Added ShowReleaseDates property (default: false)
  • Bundle.cs - Added ShowReleaseDates property to domain model
  • ChangelogConfigurationYaml.cs - YAML serialization support
  • ChangelogConfigurationLoader.cs - Configuration parsing logic

Core Services

  • ChangelogBundlingService.cs - Auto-population and profile resolution logic
  • GitHubReleaseChangelogService.cs - GitHub published_at date integration
  • GitHubReleaseService.cs - Extended GitHub API response parsing

Rendering Engine

  • ChangelogRenderingService.cs - Bundle-level rendering control
  • IndexMarkdownRenderer.cs - Conditional Markdown output
  • ChangelogAsciidocRenderer.cs - Conditional AsciiDoc output
  • ChangelogInlineRenderer.cs - Directive rendering updates

CLI Interface

  • ChangelogCommand.cs - Added --release-date and --no-release-date flags with validation

Documentation

  • Updated CLI docs (bundle.md, gh-release.md)
  • Enhanced syntax documentation (changelog.md)
  • Added contribution guidelines (contribute/changelog.md)
  • Updated example configuration (changelog.example.yml)

Usage Examples

CLI Commands

# Auto-populate with today's date (profile mode)
changelog bundle elasticsearch-release 9.1.0

# Specify explicit release date (option mode)
changelog bundle --all --release-date 2026-04-15

# Suppress release date entirely (option mode)
changelog bundle --all --no-release-date

# GitHub release with automatic date from published_at
changelog gh-release elastic/elasticsearch v9.1.0

# GitHub release with explicit override date
changelog gh-release elasticsearch v9.1.0 --release-date 2026-04-15

Configuration

# changelog.yml
bundle:
  show_release_dates: false  # Default: don't show dates
  profiles:
    release:
      show_release_dates: true  # Override for release profile
      description: "Release {version} ({lifecycle})"

Technical Implementation

Resolution Order (ShowReleaseDates)

  1. CLI flag (--no-release-date sets to false)
  2. Profile-level setting (bundle.profiles.<name>.show_release_dates)
  3. Bundle-level default (bundle.show_release_dates)
  4. System default (false)

Resolution Order (ReleaseDate)

  1. Existing bundle date (preserved during re-bundling)
  2. CLI explicit date (--release-date)
  3. GitHub release published_at (for gh-release command)
  4. Auto-populated UTC date (when not suppressed by --no-release-date)

Rendering Logic

Release dates appear in output only when:

  • ShowReleaseDates is true AND
  • A ReleaseDate value is present

Backward Compatibility

  • Default behavior: show_release_dates defaults to false - no impact on existing documentation
  • Existing bundles: Previously created bundles continue to work unchanged
  • Bundle amend: changelog bundle-amend preserves existing release date metadata
  • Configuration: Optional fields - existing config files require no updates

Testing Status

  • Compilation: All code compiles successfully
  • Existing functionality: Maintains backward compatibility with existing release-date features
  • ⚠️ New feature tests: Comprehensive tests for new ShowReleaseDates functionality should be added in follow-up work

Breaking Changes

None. All new functionality is opt-in with safe defaults.


This implementation prioritizes CI/CD automation while providing flexible control over release date rendering, supporting both automated workflows and manual release processes.

Generative AI disclosure

  1. Did you use a generative AI (GenAI) tool to assist in creating this contribution?
  • Yes
  • No
  1. If you answered "Yes" to the previous question, please specify the tool(s) and model(s) used (e.g., Google Gemini, OpenAI ChatGPT-4, etc.).

Tool(s) and model(s) used: claude-sonnet-4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant