offload-project / change-champion
A tool to manage versioning and changelogs for Composer packages, inspired by changesets
Installs: 553
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/offload-project/change-champion
Requires
- php: ^8.1
- composer/semver: ^3.0
- symfony/console: ^6.0||^7.0
- symfony/finder: ^6.0||^7.0
Requires (Dev)
- captainhook/captainhook-phar: ^5.27
- friendsofphp/php-cs-fixer: ^3.93
- phpunit/phpunit: ^10.0
- ramsey/conventional-commits: ^1.6
- dev-main
- v1.5.0
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.0
- v0.7.0
- v0.6.0
- v0.5.0
- v0.4.0
- v0.3.0
- v0.2.0
- v0.1.0
- dev-release/v1.5.0
- dev-chore/draft-release-for-action-release
- dev-feat/draft-release-config
- dev-release/v1.4.0
- dev-chore/changeset-php-v
- dev-feat/workflow-php-version
- dev-release/v1.3.1
- dev-fix/config-php-version
- dev-release/v1.3.0
- dev-feat/improve-xp-2-4
- dev-changeset-release/v1.2.0
- dev-feat/github-action
- dev-changeset-release/v1.1.1
- dev-fix/changelog-newline
- dev-fix/publish-version-bug-2-4
- dev-changeset-release/v1.1.0
- dev-fix/changeset-format
- dev-fix/changeset-release-2-4
- dev-fix/release-pr-not-triggered
- dev-feat/cc-to-changeset
- dev-feat/custom-version-prefix
- dev-changeset-release/v1.0.0
- dev-refactor/cc-to-champ
- dev-changeset-release/v0.7.0
- dev-feat/config-branch-prefix
- dev-ci/after-tests-lint
- dev-changeset-release/v0.6.0
- dev-feat/changelog-sections
- dev-changeset-release/v0.5.0
- dev-feat/issue-linking
- dev-changeset-release/v0.4.0
- dev-feat/cc-preview
- dev-changeset-release/v0.3.0
- dev-feat/cc-check
- dev-changeset-release/v0.2.0
- dev-feat/pre-release
This package is auto-updated.
Last update: 2026-02-04 19:01:12 UTC
README
A tool to manage versioning and changelogs for Composer packages, inspired by changesets.
Installation
composer require offload-project/change-champion --dev
Or install globally:
composer global require offload-project/change-champion
Quick Start
# Initialize in your project champ init # Create a changeset when you make changes champ add # View pending changesets champ status # Apply version bump and generate changelog champ version # Create a git tag champ publish
Commands
champ init
Initialize change-champion in your project. Creates a .changes directory with configuration.
champ init
# With GitHub Actions automation
champ init --with-github-actions
Options:
--with-github-actions- Also install GitHub Actions workflows for automation
champ add
Create a new changeset. Run this after making changes that should be released.
# Interactive mode champ add # Non-interactive mode champ add --type=minor --message="Add user authentication feature" # Create empty changeset (useful for CI) champ add --empty
Options:
--type,-t- Bump type:major,minor, orpatch--message,-m- Summary of the change--empty- Create an empty changeset
champ generate
Generate changesets from conventional commits (hybrid mode like release-please).
# Generate from latest tag to HEAD champ generate # Preview without creating files champ generate --dry-run # Specify commit range champ generate --from=v1.0.0 --to=HEAD
Options:
--from- Starting ref (tag, commit, or branch). Defaults to latest tag.--to- Ending ref. Defaults to HEAD.--dry-run- Show what would be generated without creating files
Conventional commit types:
| Commit Type | Changeset Type | Example |
|---|---|---|
feat |
minor | feat: add user authentication |
feat! |
major | feat!: remove deprecated API |
fix |
patch | fix: resolve null pointer |
perf |
patch | perf: optimize database queries |
refactor |
patch | refactor: extract helper function |
docs |
ignored | docs: update README |
chore |
ignored | chore: update dependencies |
test |
ignored | test: add unit tests |
ci |
ignored | ci: update workflow |
Breaking changes are detected via ! suffix (e.g., feat!:) or BREAKING CHANGE: in the commit body.
champ status
Show pending changesets and the calculated next version.
champ status
# Verbose output
champ status -v
champ version
Apply all pending changesets: update CHANGELOG.md and delete the changeset files.
# Interactive confirmation champ version # Preview changes without applying champ version --dry-run # Skip changelog generation champ version --no-changelog # Create a pre-release version champ version --prerelease alpha champ version --prerelease beta champ version --prerelease rc
Options:
--dry-run- Show what would be done without making changes--no-changelog- Skip changelog generation--prerelease,-p- Create a pre-release version (alpha, beta, rc)
Pre-release workflow:
# Create first alpha (1.0.0 → 1.1.0-alpha.1) champ version --prerelease alpha # Bump alpha (1.1.0-alpha.1 → 1.1.0-alpha.2) champ version --prerelease alpha # Move to beta (1.1.0-alpha.2 → 1.1.0-beta.1) champ version --prerelease beta # Move to RC (1.1.0-beta.1 → 1.1.0-rc.1) champ version --prerelease rc # Graduate to stable (1.1.0-rc.1 → 1.1.0) champ version
champ preview
Preview the CHANGELOG entry that would be generated without making any changes.
# Preview changelog entry champ preview # Preview with pre-release version champ preview --prerelease alpha
Options:
--prerelease,-p- Preview as a pre-release version (alpha, beta, rc)
champ check
Validate changeset files for correct format. Useful in CI to catch errors early.
champ check
Returns exit code 0 if all changesets are valid, 1 if any are invalid.
champ publish
Create a git tag for the current version.
# Create and push tag champ publish # Create tag without pushing champ publish --no-push # Preview without creating tag champ publish --dry-run
Options:
--dry-run- Show what would be done without making changes--no-push- Create tag but don't push to remote
Changeset Format
Changesets are stored in .changes/ as markdown files:
--- type: minor --- Add user authentication with OAuth2 support.
Configuration
Configuration is stored in .changes/config.json:
{
"baseBranch": "main",
"changelog": true,
"repository": "https://github.com/owner/repo",
"sections": {
"major": "Breaking Changes",
"minor": "Features",
"patch": "Fixes"
},
"releaseBranchPrefix": "release/",
"versionPrefix": "v",
"draftRelease": false
}
Options:
baseBranch- The base branch for comparisons (default:main)changelog- Whether to generate changelog entries (default:true)repository- Repository URL for linking issues (auto-detected from git remote if not set)sections- Custom section headers for changelog (defaults shown above)releaseBranchPrefix- Branch prefix for release PRs created by GitHub Actions (default:release/)versionPrefix- Prefix for version numbers in changelog headers (default:vforv1.0.0format)draftRelease- Create GitHub releases as drafts for manual publishing (default:false)
Issue Linking
Issue references in changesets are automatically linked to the repository:
--- type: patch --- Fix authentication bug. Fixes #123
Generates:
- Fix authentication bug. Fixes [#123](https://github.com/owner/repo/issues/123)
Supported patterns: #123, Fixes #123, Closes #123, Resolves #123
Semantic Versioning
Change-composer follows semver:
- patch (0.0.x) - Bug fixes, minor changes
- minor (0.x.0) - New features, backwards compatible
- major (x.0.0) - Breaking changes
When multiple changesets exist, the highest bump type wins. For example, if you have one minor and one patch
changeset, the version will be bumped as minor.
Workflow
- Make changes to your code
- Run
champ addto create a changeset describing your changes - Commit the changeset file along with your code changes
- When ready to release, run
champ versionto bump versions and update changelog - Commit the version bump
- Run
champ publishto create a git tag - Push the tag to trigger your release pipeline
GitHub Action
The easiest way to automate releases is with the change-champion action:
name: Release on: push: branches: [ main ] pull_request: types: [ closed ] branches: [ main ] permissions: contents: write pull-requests: write checks: read jobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: offload-project/change-champion@v1.3.1 # Use latest version with: token: ${{ secrets.GITHUB_TOKEN }}
This single workflow handles everything:
- Creates release PRs when changesets are merged
- Creates git tags and GitHub releases when release PRs are merged
Action Inputs
| Input | Description | Default |
|---|---|---|
token |
GitHub token for creating PRs and releases | ${{ github.token }} |
php-version |
PHP version to use | 8.2 |
version |
Version of change-champion to use | latest |
publish |
Whether to create git tag when release PR is merged | true |
Action Outputs
| Output | Description |
|---|---|
published |
Whether a release was published |
version |
The version that was released |
hasChangesets |
Whether there are pending changesets |
pullRequestNumber |
The pull request number if one was created |
GitHub Actions Workflows
Alternatively, install individual workflows for more control:
champ init --with-github-actions
This installs three workflows:
changeset-check.yml
Comments on PRs that don't include a changeset, reminding contributors to add one.
changeset-release.yml
When changesets are merged to main, automatically:
- Runs
champ versionto bump the version and update changelog - Creates a "Release vX.X.X" pull request
changeset-publish.yml
When a release PR is merged, automatically:
- Creates a git tag
- Creates a GitHub Release with changelog content
Setup
After installing the workflows, enable the required permissions:
- Go to Settings → Actions → General
- Under Workflow permissions, enable:
- "Read and write permissions"
- "Allow GitHub Actions to create and approve pull requests"
License
The MIT License (MIT). Please see License File for more information.