Skip to content

Commit 2b6c947

Browse files
rsbhclaude
andauthored
fix: add bump-version script to replace npm version in release workflow (#18)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a523c71 commit 2b6c947

4 files changed

Lines changed: 25 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ jobs:
2828
run: bun build-cli.ts
2929

3030
- name: Bump version
31-
run: |
32-
VERSION="${GITHUB_REF_NAME#v}"
33-
npm version "$VERSION" --no-git-tag-version --allow-same-version
31+
run: bun scripts/bump-version.ts
32+
env:
33+
GIT_REFNAME: ${{ github.ref_name }}
3434

3535
- name: Publish
3636
run: bun publish --access public

bun.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/chronicle/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
"@types/node": "^25.1.0",
2727
"@types/react": "^19.2.10",
2828
"@types/react-dom": "^19.2.3",
29+
"@types/semver": "^7.7.1",
2930
"openapi-types": "^12.1.3",
31+
"semver": "^7.7.4",
3032
"typescript": "5.9.3"
3133
},
3234
"dependencies": {
@@ -55,4 +57,4 @@
5557
"yaml": "^2.8.2",
5658
"zod": "^4.3.6"
5759
}
58-
}
60+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { valid, compare } from "semver"
2+
import fs from "fs/promises"
3+
import path from "path"
4+
5+
const pkgPath = path.join(import.meta.dir, "../package.json")
6+
const pkg = await Bun.file(pkgPath).json()
7+
8+
const gitRef = process.env.GIT_REFNAME
9+
const gitTag = valid(gitRef)
10+
11+
if (gitTag && compare(gitTag, pkg.version) > 0) {
12+
pkg.version = gitTag
13+
console.log("Updating version to", gitTag)
14+
await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2))
15+
}

0 commit comments

Comments
 (0)