Skip to content

Commit fb9c66a

Browse files
committed
fix(ci): replace sed version bump with npm version to prevent script corruption
The CI workflow used `sed -i "s/\"version\": \".*\"/.../"` to bump the version in package.json before publishing. This greedy regex matched every `"version": "..."` pattern in the file, including the `version` script in the `scripts` block, corrupting it from `"standard-version"` to the release version string. Replace sed with `npm version --no-git-tag-version --allow-same-version` which safely modifies only the top-level `version` field. Also restore the corrupted `version` script to its original value. Fixes #89
1 parent 1898747 commit fb9c66a

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

.github/workflows/node_sdk_publish.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ jobs:
8282
-H 'Authorization: Bearer ${{ secrets.PROJECT_API_KEY }}'
8383
8484
- name: Bump version at package.json
85-
run: |
86-
sed -i "s/\"version\": \".*\"/\"version\": \"${{ github.event.release.tag_name }}\"/" package.json
87-
cat package.json
85+
run: npm version "${{ github.event.release.tag_name }}" --no-git-tag-version --allow-same-version
8886

8987
- name: Publish package to NPM
9088
run: |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"cov:check": "nyc report && nyc check-coverage --lines 100 --functions 100 --branches 100",
4848
"docs": "typedoc",
4949
"docs:watch": "typedoc --watch",
50-
"version": "2.5.2",
50+
"version": "standard-version",
5151
"reset-hard": "git clean -dfx && git reset --hard && yarn",
5252
"prepare": "npm run build && husky install",
5353
"prepare-release": "run-s reset-hard test cov:check doc:html version doc:publish",

0 commit comments

Comments
 (0)