Skip to content

Conversation

gnodet
Copy link
Contributor

@gnodet gnodet commented Jun 11, 2025

Overview

This PR introduces a comprehensive 2-click release automation solution for Apache Maven using JBang, designed specifically for Java developers.

Features

Complete Release Workflow

  • 2-click automation: start-votepublish (or cancel if needed)
  • Apache compliance: Follows official Maven release procedures exactly
  • GitHub integration: Issues, milestones, release-drafter support
  • Email automation: Gmail SMTP for vote and announcement emails
  • Staging management: Persistent staging repo ID storage
  • Comprehensive cleanup: Cancel command with full artifact cleanup

Commands

  • setup: One-time environment validation and configuration
  • start-vote <version>: Prepare and stage release, generate vote email (Click 1)
  • publish <version>: Publish release after successful vote (Click 2)
  • cancel <version>: Cancel release and clean up all staging artifacts
  • help: Built-in command documentation

Technical Implementation

  • JBang script (1,627 lines) with modern Java libraries
  • Picocli for professional CLI with subcommands
  • Jackson for JSON parsing (GitHub API integration)
  • Apache HttpClient for email sending via Gmail SMTP
  • Type-safe implementation with comprehensive error handling
  • Full IDE support for debugging and maintenance

Benefits for Maven Developers

  • Familiar Java syntax instead of shell scripting
  • Better IDE support with debugging and refactoring
  • Type safety and compile-time error checking
  • Modern dependency management via Maven coordinates
  • Easier to extend and maintain for Java developers

Usage

# Install JBang (one-time)
curl -Ls https://sh.jbang.dev | bash -s - app setup

# Complete release workflow
jbang src/scripts/Release.java setup
jbang src/scripts/Release.java start-vote 4.0.0-rc-4
# Wait for vote results...
jbang src/scripts/Release.java publish 4.0.0-rc-4

# Or cancel if needed
jbang src/scripts/Release.java cancel 4.0.0-rc-4

Environment Variables

Required:

  • APACHE_USERNAME: Apache LDAP username
  • GPG_KEY_ID: GPG key ID for signing

Optional (for email automation):

  • GMAIL_USERNAME: Gmail address
  • GMAIL_APP_PASSWORD: Gmail app password

Security

  • All credentials stay local (no shared secrets)
  • Uses personal GPG keys and Apache credentials
  • Gmail authentication via app passwords
  • No repository secrets required

Files Added

  • src/scripts/Release.java - Complete JBang release automation script
  • src/scripts/README.md - Comprehensive documentation

Testing

The script has been tested with:

  • ✅ Command-line interface and help system
  • ✅ Environment validation and setup
  • ✅ Tool checking and credential validation
  • ✅ Error handling and user feedback

Future Enhancements

  • Integration with Maven 4.x specific features
  • Additional validation rules
  • Enhanced GitHub integration
  • Support for custom email templates

Note: This is a draft PR for review and feedback. The script provides a modern, maintainable alternative to shell-based release automation that's more familiar to Maven developers.


Pull Request opened by Augment Code with guidance from the PR author

gnodet added 6 commits June 11, 2025 17:48
This commit introduces a comprehensive 2-click release automation solution
for Apache Maven using JBang, designed specifically for Java developers.

Features:
- Complete release workflow automation following Apache procedures
- GitHub integration (issues, milestones, release-drafter)
- Gmail email automation for vote and announcement emails
- Staging repository management with persistence
- Apache distribution area management
- Website deployment automation
- Comprehensive cancellation and cleanup capabilities

Commands:
- setup: One-time environment validation and configuration
- start-vote: Prepare and stage release, generate vote email (Click 1)
- publish: Publish release after successful vote (Click 2)
- cancel: Cancel release and clean up all staging artifacts
- help: Built-in command documentation

Technical Implementation:
- JBang script (1,627 lines) with modern Java libraries
- Picocli for professional CLI with subcommands
- Jackson for JSON parsing (GitHub API integration)
- Apache HttpClient for email sending via Gmail SMTP
- Type-safe implementation with comprehensive error handling
- Full IDE support for debugging and maintenance

Benefits for Maven developers:
- Familiar Java syntax instead of shell scripting
- Better IDE support with debugging and refactoring
- Type safety and compile-time error checking
- Modern dependency management via Maven coordinates
- Easier to extend and maintain for Java developers

Usage:
  jbang src/scripts/Release.java setup
  jbang src/scripts/Release.java start-vote 4.0.0-rc-4
  jbang src/scripts/Release.java publish 4.0.0-rc-4

Environment variables:
- APACHE_USERNAME: Apache LDAP username (required)
- GPG_KEY_ID: GPG key ID for signing (required)
- GMAIL_USERNAME: Gmail address for email automation (optional)
- GMAIL_APP_PASSWORD: Gmail app password (optional)

The script maintains security by keeping all credentials local and follows
Apache Maven release procedures exactly while providing modern tooling
familiar to Java developers.
- Add Apache License 2.0 header to Release.java (JBang script)
- Add Apache License 2.0 header to README.md (documentation)
- Fixes Apache RAT check failures
- Headers follow standard Apache format for Java and Markdown files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant