--- name: git-release description: Create versioned releases — SemVer, git tags, CHANGELOG.md generation, GitHub/GitLab release notes, version bump workflows. license: MIT --- Prepare releases following semantic versioning: analyze commits, generate changelogs, create tags. For commit message conventions, see `/git-commit` skill. --- ## Semantic Versioning Format: `MAJOR.MINOR.PATCH` | Increment | When | Example | | --------- | -------------------------------- | ------------- | | MAJOR | Breaking changes | 1.0.0 → 2.0.0 | | MINOR | New backward-compatible features | 1.0.0 → 1.1.0 | | PATCH | Bug fixes | 1.0.0 → 1.0.1 | ### SemVer Rules - No leading zeroes: `1.01.0` invalid - Once released, never modify - Pre-release: `1.0.0-alpha`, `1.0.0-beta.1` --- ## Keep a Changelog Format ```markdown # Changelog ## [Unreleased] ### Added ### Changed ### Deprecated ### Removed ### Fixed ### Security ## [1.2.0] - 2024-01-15 [Unreleased]: https://github.com/owner/repo/compare/v1.2.0...HEAD [1.2.0]: https://github.com/owner/repo/compare/v1.1.0...v1.2.0 ``` --- ## git-cliff (Recommended) Fast Rust-based changelog generator using conventional commits. ### Configuration ```toml # cliff.toml [changelog] header = """ # Changelog """ body = """ {% if version %}## [{{ version }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}## [Unreleased]{% endif %} {% for group, commits in commits | group_by(attribute="group") %} ### {{ group | upper_first }} {% for commit in commits %} - {% if commit.scope %}**{{ commit.scope }}:** {% endif %}{{ commit.message | upper_first }} {% endfor %}{% endfor %} """ footer = "" trim = true [git] conventional_commits = true commit_parsers = [ { message = "^feat", group = "Added" }, { message = "^fix", group = "Fixed" }, { message = "^perf", group = "Changed" }, { message = "^refactor", group = "Changed" }, { message = "^doc", group = "Changed" }, { message = "^chore", group = "Changed" }, ] tag_pattern = "v[0-9]*" [github] owner = "owner" repo = "repo" ``` ### Commands ```bash # Generate changelog git cliff -o CHANGELOG.md # Preview unreleased changes git cliff --unreleased --dry-run # Generate for specific version git cliff v1.0.0..v2.0.0 -o RELEASE_NOTES.md ``` --- ## Release Workflow ### 1. Prepare ```bash git checkout main git pull origin main ``` ### 2. Analyze Commits Use `/git-commit` to check conventional commit format. Use git-cliff to preview changes: ```bash git cliff --unreleased --dry-run ``` ### 3. Bump Version Based on commit types: - `feat:` → minor - `fix:` → patch - `BREAKING CHANGE:` → major ### 4. Generate Changelog ```bash git cliff -o CHANGELOG.md ``` ### 5. Create Tag & Release ```bash git tag -a v1.2.0 -m "Release v1.2.0" git push origin v1.2.0 ``` Or use GitHub CLI: ```bash gh release create v1.2.0 --title "v1.2.0" --notes-file CHANGELOG.md --latest ``` --- ## Hotfix ```bash git checkout -b hotfix/v1.0.1 main # Fix issue (see /git-commit for message format) git tag -a v1.0.1 -m "Hotfix v1.0.1" git push origin v1.0.1 ``` --- ## Checklist - [ ] Tests pass - [ ] Build succeeds - [ ] Changelog accurate - [ ] Breaking changes documented - [ ] Tag pushed