@far-world-labs/verblets 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +59 -9
- package/package.json +7 -4
- package/scripts/version-bump.js +33 -0
package/.github/workflows/ci.yml
CHANGED
|
@@ -72,11 +72,50 @@ jobs:
|
|
|
72
72
|
echo "✅ ESLint checks completed"
|
|
73
73
|
echo "✅ Library is ready for deployment"
|
|
74
74
|
|
|
75
|
+
# Version bump for PRs - creates commit in PR branch
|
|
76
|
+
version-bump:
|
|
77
|
+
name: 📦 Version Bump
|
|
78
|
+
runs-on: ubuntu-latest
|
|
79
|
+
needs: build
|
|
80
|
+
if: github.event_name == 'pull_request'
|
|
81
|
+
permissions:
|
|
82
|
+
contents: write
|
|
83
|
+
pull-requests: write
|
|
84
|
+
steps:
|
|
85
|
+
- uses: actions/checkout@v4
|
|
86
|
+
with:
|
|
87
|
+
fetch-depth: 0
|
|
88
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
89
|
+
ref: ${{ github.head_ref }}
|
|
90
|
+
- uses: actions/setup-node@v4
|
|
91
|
+
with:
|
|
92
|
+
node-version: 20.x
|
|
93
|
+
cache: 'npm'
|
|
94
|
+
- run: npm ci
|
|
95
|
+
|
|
96
|
+
- name: Configure Git
|
|
97
|
+
run: |
|
|
98
|
+
git config --global user.name "github-actions[bot]"
|
|
99
|
+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
100
|
+
|
|
101
|
+
- name: Version Bump (No Publish)
|
|
102
|
+
env:
|
|
103
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
104
|
+
run: |
|
|
105
|
+
# Ensure we're on the correct branch
|
|
106
|
+
git checkout ${{ github.head_ref }}
|
|
107
|
+
|
|
108
|
+
# Use release-it to bump version and create tag, but skip npm publish
|
|
109
|
+
npx release-it --ci --no-npm.publish --no-github.release
|
|
110
|
+
|
|
111
|
+
# Push the version bump back to the PR branch
|
|
112
|
+
git push origin ${{ github.head_ref }}
|
|
113
|
+
|
|
75
114
|
# Required status check that gates merge operations
|
|
76
115
|
pr-ready-to-merge:
|
|
77
116
|
name: ✅ PR Ready to Merge
|
|
78
117
|
runs-on: ubuntu-latest
|
|
79
|
-
needs: [lint, test, build]
|
|
118
|
+
needs: [lint, test, build, version-bump]
|
|
80
119
|
if: github.event_name == 'pull_request'
|
|
81
120
|
steps:
|
|
82
121
|
- name: All checks passed
|
|
@@ -85,11 +124,13 @@ jobs:
|
|
|
85
124
|
echo "✅ Linting: Passed"
|
|
86
125
|
echo "✅ Tests: Passed on all LTS Node versions"
|
|
87
126
|
echo "✅ Build: Successful"
|
|
127
|
+
echo "✅ Version: Bumped and ready"
|
|
88
128
|
echo ""
|
|
89
129
|
echo "This PR is now ready for squash and merge."
|
|
90
130
|
|
|
131
|
+
# Publish the already-bumped version on merge to main
|
|
91
132
|
release:
|
|
92
|
-
name: 🚀
|
|
133
|
+
name: 🚀 Publish to NPM
|
|
93
134
|
runs-on: ubuntu-latest
|
|
94
135
|
needs: build
|
|
95
136
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
@@ -108,13 +149,22 @@ jobs:
|
|
|
108
149
|
cache: 'npm'
|
|
109
150
|
- run: npm ci
|
|
110
151
|
|
|
111
|
-
- name:
|
|
152
|
+
- name: Publish to NPM
|
|
153
|
+
env:
|
|
154
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
112
155
|
run: |
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- name: Release
|
|
156
|
+
# Simple publish - version is already bumped in package.json from PR
|
|
157
|
+
npm publish --access public
|
|
158
|
+
|
|
159
|
+
- name: Create GitHub Release
|
|
117
160
|
env:
|
|
118
161
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
119
|
-
|
|
120
|
-
|
|
162
|
+
run: |
|
|
163
|
+
# Get version from package.json
|
|
164
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
165
|
+
|
|
166
|
+
# Create GitHub release
|
|
167
|
+
gh release create "v$VERSION" \
|
|
168
|
+
--title "Release v$VERSION" \
|
|
169
|
+
--notes "Automated release of version $VERSION" \
|
|
170
|
+
--latest
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@far-world-labs/verblets",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "OpenAI Client",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -23,9 +23,12 @@
|
|
|
23
23
|
"husky:install": "husky install",
|
|
24
24
|
"husky:uninstall": "husky uninstall",
|
|
25
25
|
"prepare": "npx husky install",
|
|
26
|
-
"version:patch": "
|
|
27
|
-
"version:minor": "
|
|
28
|
-
"version:major": "
|
|
26
|
+
"version:patch": "node scripts/version-bump.js patch",
|
|
27
|
+
"version:minor": "node scripts/version-bump.js minor",
|
|
28
|
+
"version:major": "node scripts/version-bump.js major",
|
|
29
|
+
"release:patch": "node scripts/version-bump.js patch",
|
|
30
|
+
"release:minor": "node scripts/version-bump.js minor",
|
|
31
|
+
"release:major": "node scripts/version-bump.js major"
|
|
29
32
|
},
|
|
30
33
|
"config": {
|
|
31
34
|
"gen-script": "./scripts/run.sh gen-$1"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execSync } from 'child_process';
|
|
4
|
+
import { readFileSync } from 'fs';
|
|
5
|
+
|
|
6
|
+
const args = process.argv.slice(2);
|
|
7
|
+
const bumpType = args[0] || 'patch'; // patch, minor, major
|
|
8
|
+
|
|
9
|
+
if (!['patch', 'minor', 'major'].includes(bumpType)) {
|
|
10
|
+
console.error('Usage: node scripts/version-bump.js [patch|minor|major]');
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
console.log(`🔄 Bumping ${bumpType} version...`);
|
|
16
|
+
|
|
17
|
+
// Use release-it to bump version and create tag (no publish, no GitHub release)
|
|
18
|
+
execSync(`npx release-it ${bumpType} --ci --no-npm.publish --no-github.release`, {
|
|
19
|
+
stdio: 'inherit'
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Get the new version
|
|
23
|
+
const pkg = JSON.parse(readFileSync('package.json', 'utf8'));
|
|
24
|
+
const newVersion = pkg.version;
|
|
25
|
+
|
|
26
|
+
console.log(`✅ Version bumped to ${newVersion}`);
|
|
27
|
+
console.log('📝 Commit and push this change in your PR');
|
|
28
|
+
console.log('🚀 Publishing will happen automatically when PR is merged');
|
|
29
|
+
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error('❌ Version bump failed:', error.message);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|