Skip to content

Commit 3571422

Browse files
authored
Merge pull request #30 from codcod/28-use-release-branches
ci: add new release strategy based on release branches
2 parents 5a7924a + c1ad9ca commit 3571422

File tree

3 files changed

+142
-8
lines changed

3 files changed

+142
-8
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,26 @@ on:
44
push:
55
branches:
66
- main
7+
- 'release/**'
78
paths:
89
- 'src/**'
910
- 'Cargo.toml'
1011
- 'Cargo.lock'
1112
pull_request:
1213
branches:
1314
- main
15+
- 'release/**'
1416
paths:
1517
- 'src/**'
1618
- 'Cargo.toml'
1719
- 'Cargo.lock'
20+
workflow_dispatch:
21+
inputs:
22+
release_branch:
23+
description: 'Release branch to build from (e.g., release/1.2)'
24+
required: false
25+
default: 'main'
26+
type: string
1827

1928
permissions:
2029
contents: write
@@ -60,22 +69,20 @@ jobs:
6069
- name: Checkout code
6170
uses: actions/checkout@v5
6271
with:
72+
ref: ${{ github.event.inputs.release_branch || github.ref }}
6373
fetch-depth: 0
6474

65-
- name: Semantic Version
75+
- name: Semantic version
6676
id: version
67-
uses: paulhatch/semantic-version@v5.4.0
77+
uses: PaulHatch/semantic-version@v5.4.0
6878
with:
6979
tag_prefix: "v"
70-
major_pattern: "(MAJOR|BREAKING CHANGE|!:)"
71-
minor_pattern: "(MINOR|feat:|feature:)"
72-
version_format: "${major}.${minor}.${patch}"
73-
change_path: "src"
74-
namespace: ""
80+
major_pattern: "BREAKING CHANGE:"
81+
minor_pattern: "feat:"
7582
bump_each_commit: false
7683
search_commit_body: true
7784
user_format_type: "csv"
78-
enable_prerelease_mode: false
85+
enable_prerelease_mode: true
7986

8087
create-release:
8188
name: Create Release

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ Tip: mount host workspace if operations need local files:
292292

293293
- [Release Guide](docs/release.md) - Release conventions
294294
- [Semantic Versioning Guide](docs/semantic.md) - How to use semantic versioning
295+
- [Release Strategy](docs/release-strategy.md) - Release branch strategy and feature aggregation
295296

296297
## Alternatives
297298

docs/release-strategy.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Release Branch Strategy
2+
3+
This document outlines the release branch strategy for semantic versioning and feature aggregation in the repos project.
4+
5+
## Overview
6+
7+
Instead of creating individual releases for each feature or fix, we use release branches to aggregate multiple changes into a single semantic version release. This provides better control over releases and allows for more meaningful version increments.
8+
9+
## Process
10+
11+
### 1. Feature Development
12+
13+
- Develop features and fixes on feature branches as usual
14+
- Merge approved changes to `main` branch
15+
- No releases are automatically created from `main` branch commits
16+
17+
### 2. Release Preparation
18+
19+
When ready to create a new release:
20+
21+
1. **Create a release branch** from `main`:
22+
23+
```bash
24+
git checkout main
25+
git pull origin main
26+
git checkout -b release/1.2.0
27+
```
28+
29+
2. **Push the release branch**:
30+
31+
```bash
32+
git push -u origin release/1.2.0
33+
```
34+
35+
3. **Automatic release creation**: The GitHub Actions workflow will:
36+
- Analyze all commits since the last release
37+
- Determine the appropriate semantic version increment
38+
- Create a new release with aggregated changelog
39+
- Build and upload release artifacts
40+
41+
### 3. Manual Release Trigger
42+
43+
You can also manually trigger a release:
44+
45+
1. Go to the **Actions** tab in GitHub
46+
2. Select the **Release** workflow
47+
3. Click **Run workflow**
48+
4. Optionally specify a release branch (defaults to `main`)
49+
50+
## Semantic Versioning Rules
51+
52+
The workflow analyzes commit messages to determine version increments:
53+
54+
- **Major version** (1.0.0 → 2.0.0): Commits containing `BREAKING CHANGE:` in the body
55+
- **Minor version** (1.0.0 → 1.1.0): Commits with `feat:` prefix
56+
- **Patch version** (1.0.0 → 1.0.1): All other changes (fixes, docs, etc.)
57+
58+
## Conventional Commits
59+
60+
To ensure proper semantic versioning, use conventional commit format:
61+
62+
```text
63+
<type>[optional scope]: <description>
64+
65+
[optional body]
66+
67+
[optional footer(s)]
68+
```
69+
70+
### Examples
71+
72+
- **Feature**: `feat: add support for organization-wide repository listing`
73+
- **Fix**: `fix: handle rate limiting in GitHub API calls`
74+
- **Breaking change**:
75+
76+
```text
77+
feat: redesign configuration file format
78+
79+
BREAKING CHANGE: Configuration file format has changed from YAML to JSON.
80+
Users must migrate their existing config files.
81+
```
82+
83+
## Branch Management
84+
85+
- **`main`**: Latest development code, always deployable
86+
- **`release/*`**: Release preparation branches (e.g., `release/1.2.0`)
87+
- **Feature branches**: Individual feature development (merged to `main`)
88+
89+
## Workflow Configuration
90+
91+
The release workflow (`/.github/workflows/release.yml`) is configured with:
92+
93+
- **`bump_each_commit: false`**: Only increment version once per release
94+
- **`search_commit_body: true`**: Look for breaking changes in commit bodies
95+
- **Release branch triggers**: Automatically trigger on `release/*` branches
96+
- **Manual dispatch**: Allow manual release creation
97+
98+
## Benefits
99+
100+
1. **Controlled releases**: Choose when to release and what to include
101+
2. **Meaningful versions**: Aggregate related changes into single releases
102+
3. **Better changelogs**: Comprehensive release notes for multiple features
103+
4. **Flexibility**: Manual and automatic release options
104+
5. **Semantic accuracy**: Proper version increments based on actual impact
105+
106+
## Example Workflow
107+
108+
```bash
109+
# Develop features
110+
git checkout -b feature/new-command
111+
# ... develop and test
112+
git checkout main
113+
git merge feature/new-command
114+
115+
git checkout -b feature/ui-improvements
116+
# ... develop and test
117+
git checkout main
118+
git merge feature/ui-improvements
119+
120+
# Ready to release
121+
git checkout -b release/1.3.0
122+
git push -u origin release/1.3.0
123+
# → GitHub Actions creates v1.3.0 release automatically
124+
```
125+
126+
This strategy ensures that releases are intentional, well-tested, and contain meaningful collections of changes rather than incremental updates for every small modification.

0 commit comments

Comments
 (0)