Skip to content

Commit 00e053d

Browse files
committed
ci: switch branching to main+release, drop dev branch
- CI now runs on push to main (was dev) - Release workflow triggers on push to release (was main) - Changelog archives to main with release fast-forward - Updated all docs to reflect new branch pattern
1 parent 97ddea1 commit 00e053d

5 files changed

Lines changed: 43 additions & 33 deletions

File tree

.changelog/README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,31 @@ Update `.changelog/v0.2.x.md` **every time** you add features and fixes:
7979
- Keep the version in the file as `v0.2.x` (literal x)
8080
- Don't worry about the final patch number - it will be substituted automatically
8181

82-
### Before Merging to Main
82+
### Before Releasing
8383

84-
Final review before release:
84+
Final review before pushing to `release`:
8585
- Ensure all changes are documented
8686
- Add release date (update "YYYY-MM-DD" to actual date)
8787
- Review and polish the content
8888
- Commit the changelog file
89+
- Bump version in `package.json`
90+
91+
### Triggering a Release
92+
93+
Push main to the release branch:
94+
95+
```bash
96+
git push origin main:release
97+
```
8998

9099
### On Release
91100

92101
The GitHub Actions workflow automatically:
93102
1. Reads `.changelog/v0.2.x.md`
94103
2. Replaces all instances of `0.2.x` with the actual version (e.g., `0.2.5`)
95104
3. Creates the GitHub release with the substituted changelog
96-
4. Renames `v0.2.x.md``v0.2.5.md` (preserves git history)
97-
5. Bumps dev to next minor version
105+
4. Renames `v0.2.x.md``v0.2.5.md` on `main` (preserves git history)
106+
5. Fast-forwards `release` to match `main`
98107

99108
### After Release
100109

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CI
22

33
on:
44
push:
5-
branches: [dev]
6-
pull_request:
75
branches: [main]
6+
pull_request:
7+
branches: [main, release]
88

99
# Cancel duplicate runs for the same branch/PR
1010
concurrency:

.github/workflows/release.yml

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [release]
66

77
permissions:
88
contents: write
@@ -100,41 +100,30 @@ jobs:
100100
env:
101101
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102102

103-
- name: Archive changelog on dev branch
103+
- name: Archive changelog on main
104104
if: steps.tag-check.outputs.exists == 'false'
105105
run: |
106106
CURRENT_VERSION=${{ steps.package-version.outputs.version }}
107107
MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1)
108108
MINOR=$(echo $CURRENT_VERSION | cut -d. -f2)
109109
MAJOR_MINOR="$MAJOR.$MINOR"
110110
111-
# Checkout dev branch
112-
git fetch origin dev
113-
git checkout dev
114-
115-
# Rename and version the changelog file
116111
PATTERN_FILE=".changelog/v${MAJOR_MINOR}.x.md"
117112
VERSIONED_FILE=".changelog/v${CURRENT_VERSION}.md"
118113
119114
if [ -f "$PATTERN_FILE" ]; then
120-
# Rename the file (preserves git history)
121-
git mv "$PATTERN_FILE" "$VERSIONED_FILE"
115+
# Archive directly on main so release never diverges
116+
git fetch origin main
117+
git checkout main
122118
123-
# Replace version placeholders in the renamed file
124-
sed -i.bak "s/v${MAJOR_MINOR}\.x/v${CURRENT_VERSION}/g; s/${MAJOR_MINOR}\.x/${CURRENT_VERSION}/g" "$VERSIONED_FILE"
119+
git mv "$PATTERN_FILE" "$VERSIONED_FILE"
120+
sed -i.bak "s/v${MAJOR_MINOR}\.x/v${CURRENT_VERSION}/g; s/${MAJOR_MINOR}\.x/${CURRENT_VERSION}/g; s/YYYY-MM-DD/$(date +%Y-%m-%d)/g" "$VERSIONED_FILE"
125121
rm "${VERSIONED_FILE}.bak"
126122
127-
# Commit the renamed and updated changelog
128123
git add "$VERSIONED_FILE"
129124
git commit -m "docs: archive changelog for v${CURRENT_VERSION} [skip ci]"
130-
git push origin dev
131-
132-
# Store the changelog commit SHA before switching branches
133-
CHANGELOG_COMMIT=$(git rev-parse HEAD)
134-
135-
# Merge changelog back to main (without triggering CI)
136-
git checkout main
137-
git cherry-pick "$CHANGELOG_COMMIT"
138125
git push origin main
139-
git checkout dev
126+
127+
# Fast-forward release to match main
128+
git push origin main:release
140129
fi

CLAUDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ Layer 1: Raw Provider Cache → JSON files (data/person/*.json)
7575

7676
## Git Workflow
7777

78-
- **dev**: Active development (auto-bumps patch on CI)
79-
- **main**: Production releases only
78+
- **main**: Active development
79+
- **release**: Push `main` to `release` to trigger GitHub Release workflow
8080
- **Push pattern**: `git pull --rebase --autostash && git push`
81+
- **Release**: `git push origin main:release`
8182
- **Changelog**: Update `.changelog/v{major}.{minor}.x.md` with changes
8283
- **Commit often**: After each feature or bug fix
8384

docs/development.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,28 @@ The browser profile is stored in `.browser/data/` to persist logins.
103103

104104
### Branches
105105

106-
- **dev**: Active development (auto-bumps patch on CI pass)
107-
- **main**: Production releases only
106+
- **main**: Active development
107+
- **release**: Push `main` to `release` to trigger the GitHub Release workflow
108108

109109
### Pushing Changes
110110

111-
The dev branch receives auto version bump commits from CI. Always use rebase:
111+
Always use rebase:
112112

113113
```bash
114114
git pull --rebase --autostash && git push
115115
```
116116

117+
### Releasing
118+
119+
```bash
120+
# 1. Bump version in package.json
121+
# 2. Ensure .changelog/v{major}.{minor}.x.md is up to date
122+
# 3. Push to main, then trigger release:
123+
git push origin main:release
124+
```
125+
126+
The release workflow will create a GitHub Release, archive the changelog on `main`, and fast-forward the `release` branch to match.
127+
117128
### Commit Guidelines
118129

119130
- Create commits after each feature or bug fix
@@ -126,7 +137,7 @@ All release notes are maintained in `.changelog/v{major}.{minor}.x.md` files:
126137

127138
1. Add entries under appropriate emoji sections during development
128139
2. Keep version as `0.3.x` (CI replaces with actual version on release)
129-
3. Final review before merging `dev → main`
140+
3. Final review before pushing to `release`
130141

131142
See `.changelog/README.md` for detailed format.
132143

0 commit comments

Comments
 (0)