Skip to content

Commit 3a9512f

Browse files
authored
Merge pull request #23 from chrisribe/copilot/bump-release-version-on-commit
Add automated version bumping on commits to main branch
2 parents 454b834 + 8cecb43 commit 3a9512f

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Auto Version Bump
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '**.md'
9+
- 'docs/**'
10+
11+
jobs:
12+
bump-version:
13+
runs-on: ubuntu-latest
14+
15+
# Skip if commit message contains [skip-version] or is from the bot itself
16+
if: "!contains(github.event.head_commit.message, '[skip-version]') && github.event.head_commit.author.name != 'github-actions[bot]'"
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
fetch-depth: 0
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '20'
29+
cache: 'npm'
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Bump version and build
35+
run: npm run build:release
36+
37+
- name: Configure git
38+
run: |
39+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
40+
git config --local user.name "github-actions[bot]"
41+
42+
- name: Commit version bump
43+
run: |
44+
git add package.json
45+
git commit -m "chore: bump version [skip-version]" || echo "No changes to commit"
46+
47+
- name: Push changes
48+
run: git push
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11+
- **Automated Version Bumping**: GitHub Actions workflow automatically bumps patch version on every commit/merge to main branch
12+
- Uses existing `npm run build:release` command
13+
- Commits changes back to repository with `[skip-version]` tag
14+
- Skips documentation-only changes (markdown files and docs directory)
15+
- Prevents infinite loops with bot detection
16+
1117
- **Export/Import System**: Backup and restore memories across machines
1218
- `export-memory` command - Export memories to JSON with optional filtering
1319
- `import-memory` command - Import memories with duplicate detection

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,9 @@ npm run dev
435435
# Build TypeScript
436436
npm run build
437437

438+
# Build with version bump (for releases)
439+
npm run build:release
440+
438441
# Run all tests (28 tests)
439442
npm run test:all
440443

@@ -456,6 +459,20 @@ npm unlink -g # Unlink from global
456459
simple-memory memory-stats # Test the global command
457460
```
458461

462+
### Versioning
463+
464+
The project uses automated version bumping:
465+
466+
- **Development builds**: Use `npm run build` (no version change)
467+
- **Release builds**: Use `npm run build:release` (bumps patch version)
468+
- **Manual version bumps**: Use `npm run version:patch|minor|major`
469+
- **Automatic**: All commits/merges to `main` automatically bump the patch version via GitHub Actions
470+
471+
The workflow skips version bumps for:
472+
- Documentation-only changes (`.md` files)
473+
- Changes to `docs/` directory
474+
- Commits containing `[skip-version]` in the message
475+
459476
### Testing
460477

461478
The project has comprehensive test coverage:

0 commit comments

Comments
 (0)