๐ Gem Publication System Documentation
This document describes the comprehensive gem publication system for Jekyll Theme Zer0, including VS Code integration and automatic changelog generation.
๐ New Publication Script
gem-publish.sh
- Comprehensive Publication Workflow
The new comprehensive script that handles the entire gem publication process:
./scripts/gem-publish.sh [patch|minor|major] [options]
Key Features:
- ๐ Automatic Changelog Generation: Analyzes commit history since last version
- ๐ข Semantic Versioning: Handles patch, minor, and major version bumps
- ๐งช Comprehensive Testing: Runs full test suite before publication
- ๐ฆ Gem Building & Validation: Builds and validates gem packages
- ๐ RubyGems Publication: Publishes to RubyGems.org
- ๐ท๏ธ GitHub Releases: Creates GitHub releases with assets
- ๐ Git Integration: Handles commits, tags, and repository synchronization
Usage Examples:
# Patch release (bug fixes)
./scripts/gem-publish.sh patch
# Minor release (new features)
./scripts/gem-publish.sh minor
# Major release (breaking changes)
./scripts/gem-publish.sh major
# Preview what would happen (dry run)
./scripts/gem-publish.sh patch --dry-run
# Skip publishing (development testing)
./scripts/gem-publish.sh patch --skip-publish --no-github-release
# Non-interactive mode (CI/CD)
./scripts/gem-publish.sh patch --non-interactive
๐๏ธ VS Code Integration
New launch configurations in .vscode/launch.json
:
- ๐ Gem Publisher: Patch Release - Full patch version workflow
- ๐ Gem Publisher: Minor Release - Full minor version workflow
- ๐ Gem Publisher: Major Release - Full major version workflow
- ๐ Gem Publisher: Dry Run (Patch) - Preview changes without modifications
- โก Gem Publisher: Quick Build & Test - Development workflow, skip publishing
- ๐ Gem Publisher: Changelog Preview - Preview changelog generation only
Task Runner (Ctrl+Shift+P โ โTasks: Run Taskโ)
New tasks in .vscode/tasks.json
:
Gem Management Tasks:
- ๐ Gem: Patch Release - Full patch release workflow
- ๐ Gem: Minor Release - Full minor release workflow
- ๐ Gem: Major Release - Full major release workflow
- ๐ Gem: Dry Run Preview - Preview changes without modifications
- โก Gem: Quick Build & Test - Development workflow (default build task)
- ๐ Gem: Generate Changelog - Preview changelog generation
- ๐งช Gem: Run Tests Only - Run test suite only (default test task)
- ๐จ Gem: Build Only - Build gem without publishing
- ๐ Gem: Version Info - Display current version and git status
๐ Automatic Changelog Generation
Commit Categorization
The system automatically categorizes commits based on conventional commit prefixes:
Added (New Features)
feat: add user authentication system
feature(api): implement rate limiting
Fixed (Bug Fixes)
fix: resolve memory leak in parser
bugfix(ui): correct button alignment issue
Changed (Modifications)
chore: update dependencies
refactor: improve code organization
perf: optimize database queries
style: fix code formatting
docs: update API documentation
test: add integration tests
ci: update workflow configuration
build: improve build process
Security (Security Updates)
security: patch XSS vulnerability
sec: update authentication tokens
Deprecated & Removed
# Deprecated - any commit containing "deprecat"
# Removed
remove: delete legacy API endpoints
rm: clean up unused files
## [1.2.3] - 2025-01-27
### Added
- User authentication system
- API rate limiting functionality
### Changed
- Updated dependencies to latest versions
- Improved code organization and structure
### Fixed
- Resolved memory leak in parser component
- Corrected button alignment in mobile view
### Security
- Patched XSS vulnerability in form processing
๐ฆ Complete Workflow Process
1. Environment Validation
- Checks git repository status (must be clean)
- Validates required files exist
- Confirms RubyGems authentication
- Verifies command availability
2. Changelog Generation
- Analyzes commit history since last version tag
- Categories commits by type (Added, Changed, Fixed, Security, etc.)
- Generates structured changelog entry
- Updates CHANGELOG.md file
- Shows preview for review
3. Version Management
- Reads current version from
lib/jekyll-theme-zer0/version.rb
- Calculates new version based on type (patch/minor/major)
- Updates version in Ruby version file and package.json
4. Testing & Building
- Runs comprehensive test suite (
bundle exec rspec
)
- Validates gemspec syntax
- Builds gem package
- Shows package summary
5. Publication
- Checks for version conflicts on RubyGems
- Publishes gem to RubyGems.org
- Creates git commit and tag
- Generates GitHub release with gem asset
6. Repository Synchronization
- Pushes changes to repository
- Pushes tags to repository
- Updates remote tracking
๐ง Prerequisites & Setup
# Check if tools are available
which git ruby gem bundle jq gh
Authentication Setup
# RubyGems authentication
gem signin
# GitHub CLI authentication (for releases)
gh auth login
File Requirements
lib/jekyll-theme-zer0/version.rb
- Version definition
jekyll-theme-zer0.gemspec
- Gem specification
CHANGELOG.md
- Changelog file
- Clean git working directory
๐ Troubleshooting
Common Issues
โWorking directory is not cleanโ
git status # Check what's uncommitted
git add . && git commit -m "commit message"
# or
git stash # Temporarily stash changes
โNot authenticated with RubyGemsโ
gem signin # Sign in to RubyGems.org
โVersion already existsโ
The script prevents republishing existing versions - you need to bump the version number first.
โTests failedโ
Fix test failures before proceeding, or use --skip-tests
for emergency releases (not recommended).
Debug Mode
bash -x ./scripts/gem-publish.sh patch --dry-run
๐ Security Features
- Prevents republishing existing versions
- Requires clean git working directory
- Validates gem contents before publishing
- Confirms user intent for destructive operations
- API keys managed securely (RubyGems credentials, GitHub CLI)
๐ฏ How to Use
For Development (Quick Testing)
- Use โก Gem: Quick Build & Test task or launch config
- This generates changelog, bumps version, runs tests, builds gem
- But skips publishing to RubyGems
For Preview (See What Would Happen)
- Use ๐ Gem: Dry Run Preview task or launch config
- Shows exactly what changes would be made
- Great for reviewing changelog generation
For Real Releases
- Ensure working directory is clean
- Use appropriate release type:
- Patch (0.0.X): Bug fixes
- Minor (0.X.0): New features, backward compatible
- Major (X.0.0): Breaking changes
- Use launch config or run:
./scripts/gem-publish.sh [type]
Access Methods
Via VS Code Debug Panel (F5)
- Open VS Code
- Press F5 or go to Run & Debug panel
- Select desired gem publication configuration
- Click play button
Via VS Code Task Runner
- Press Ctrl+Shift+P (Cmd+Shift+P on Mac)
- Type โTasks: Run Taskโ
- Select desired gem task from the list
Via Terminal
cd /path/to/zer0-mistakes
./scripts/gem-publish.sh patch --dry-run
๐ Integration Benefits
- Streamlined Workflow: One command handles entire publication process
- Consistent Changelogs: Automatic generation from commit history
- Error Prevention: Comprehensive validation at each step
- Development Friendly: Multiple modes for different scenarios
- VS Code Native: Integrated with familiar VS Code workflows
- Documentation: Automatic GitHub releases with detailed information
This system transforms gem publication from a manual, error-prone process into a reliable, automated workflow while maintaining full control and visibility.