Skip to content

Commit 2dd41cd

Browse files
committed
feat: Add automated version tagging and release workflow
- Add GitHub Action for automatic version tagging on push - Create version bump script for easy manual versioning - Add npm scripts for version management (patch, minor, major, prerelease) - Auto-create GitHub releases with changelog - Keep npm publishing manual for better control - Skip version tagging for documentation-only changes
1 parent 5f3f197 commit 2dd41cd

3 files changed

Lines changed: 142 additions & 1 deletion

File tree

.github/workflows/version-tag.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Auto Version Tag
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths-ignore:
7+
- 'README.md'
8+
- 'CHANGELOG.md'
9+
- '*.md'
10+
11+
jobs:
12+
version-tag:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '18'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Run linting
30+
run: npm run lint
31+
32+
- name: Build project
33+
run: npm run build
34+
35+
- name: Get current version
36+
id: version
37+
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
38+
39+
- name: Check if tag exists
40+
id: tag-check
41+
run: |
42+
if git rev-parse "v${{ steps.version.outputs.VERSION }}" >/dev/null 2>&1; then
43+
echo "EXISTS=true" >> $GITHUB_OUTPUT
44+
else
45+
echo "EXISTS=false" >> $GITHUB_OUTPUT
46+
fi
47+
48+
- name: Create and push tag
49+
if: steps.tag-check.outputs.EXISTS == 'false'
50+
run: |
51+
git config --local user.email "action@github.com"
52+
git config --local user.name "GitHub Action"
53+
git tag "v${{ steps.version.outputs.VERSION }}"
54+
git push origin "v${{ steps.version.outputs.VERSION }}"
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Create Release
59+
if: steps.tag-check.outputs.EXISTS == 'false'
60+
uses: actions/create-release@v1
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
with:
64+
tag_name: v${{ steps.version.outputs.VERSION }}
65+
release_name: Release v${{ steps.version.outputs.VERSION }}
66+
body: |
67+
## What's New in v${{ steps.version.outputs.VERSION }}
68+
69+
This release includes:
70+
- Roo Custom Modes support as third output format
71+
- Enhanced multi-format support (Cursor, Cline, Roo)
72+
- Fixed repomix output to single file
73+
- Improved error handling and rate limiting
74+
- Updated documentation and examples
75+
76+
## Installation
77+
```bash
78+
npm install -g cursorifier
79+
```
80+
81+
## Usage
82+
```bash
83+
# Cursor AI Rules
84+
cursorifier . --output-format cursor
85+
86+
# Cline Rules
87+
cursorifier . --output-format cline
88+
89+
# Roo Custom Modes
90+
cursorifier . --output-format roo
91+
```
92+
draft: false
93+
prerelease: false

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
"build": "rimraf lib && tsc -p tsconfig.json --sourceMap --declaration",
1818
"lint": "eslint src --ext .ts",
1919
"test": "echo 'No tests yet' && exit 0",
20-
"prepublishOnly": "npm run lint && npm run build"
20+
"prepublishOnly": "npm run lint && npm run build",
21+
"version:patch": "node scripts/version-bump.js patch",
22+
"version:minor": "node scripts/version-bump.js minor",
23+
"version:major": "node scripts/version-bump.js major",
24+
"version:prerelease": "node scripts/version-bump.js prerelease"
2125
},
2226
"keywords": [
2327
"cursor",

scripts/version-bump.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env node
2+
3+
const { execSync } = require('child_process');
4+
const fs = require('fs');
5+
const path = require('path');
6+
7+
// Get the version type from command line args
8+
const versionType = process.argv[2] || 'patch';
9+
const validTypes = ['patch', 'minor', 'major', 'prerelease'];
10+
11+
if (!validTypes.includes(versionType)) {
12+
console.error(`❌ Invalid version type: ${versionType}`);
13+
console.error(`Valid types: ${validTypes.join(', ')}`);
14+
process.exit(1);
15+
}
16+
17+
try {
18+
console.log(`🔄 Bumping ${versionType} version...`);
19+
20+
// Run npm version
21+
const result = execSync(`npm version ${versionType}`, {
22+
encoding: 'utf8',
23+
stdio: 'pipe'
24+
});
25+
26+
const newVersion = result.trim();
27+
console.log(`✅ Version bumped to: ${newVersion}`);
28+
29+
// Read package.json to get the new version
30+
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
31+
const version = packageJson.version;
32+
33+
console.log(`\n📝 Next steps:`);
34+
console.log(`1. Review changes: git diff`);
35+
console.log(`2. Commit changes: git add . && git commit -m "chore: bump version to ${version}"`);
36+
console.log(`3. Push to GitHub: git push && git push --tags`);
37+
console.log(`4. Publish to npm: npm publish`);
38+
39+
console.log(`\n🚀 The GitHub Action will automatically create a release when you push!`);
40+
41+
} catch (error) {
42+
console.error(`❌ Error bumping version:`, error.message);
43+
process.exit(1);
44+
}

0 commit comments

Comments
 (0)