Skip to content

Commit b5602c3

Browse files
committed
fix(sdk): address code review feedback for release workflows
- Align tsconfig lib to es2020 to match target in all three tsconfig files - Remove machine-local .claude/settings.local.json from tracking and add to .gitignore - Remove non-reproducible npm@latest install step from JS workflow - Fix JS workflow version extraction: read from package.json on workflow_dispatch, verify tag matches package.json on tag push - Fix Python workflow version extraction: read from pyproject.toml on workflow_dispatch, verify tag matches pyproject.toml on tag push
1 parent 4520abf commit b5602c3

8 files changed

Lines changed: 40 additions & 36 deletions

File tree

.github/workflows/js-sdk-release.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ jobs:
3333
node-version: '20'
3434
registry-url: 'https://registry.npmjs.org'
3535

36-
- name: Upgrade npm for OIDC support
37-
run: |
38-
npm install -g npm@latest
39-
echo "npm version: $(npm --version)"
40-
4136
- name: Verify OIDC token availability
4237
run: |
4338
if [ -n "${ACTIONS_ID_TOKEN_REQUEST_URL}" ] && [ -n "${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" ]; then
@@ -71,21 +66,29 @@ jobs:
7166
working-directory: sdk/js
7267
run: npm run build
7368

74-
- name: Determine npm dist-tag
69+
- name: Determine version and npm dist-tag
7570
id: tag
71+
working-directory: sdk/js
7672
run: |
77-
VERSION="${GITHUB_REF_NAME#js-sdk-v}"
78-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
73+
PKG_VERSION=$(node -e "console.log(require('./package.json').version)")
7974
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
75+
VERSION="$PKG_VERSION"
8076
echo "tag=${{ github.event.inputs.npm_tag }}" >> "$GITHUB_OUTPUT"
8177
else
78+
TAG_VERSION="${GITHUB_REF_NAME#js-sdk-v}"
79+
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
80+
echo "::error::tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)"
81+
exit 1
82+
fi
83+
VERSION="$TAG_VERSION"
8284
# auto-detect from git tag: js-sdk-v0.5.8-beta.1 -> beta
8385
if echo "$VERSION" | grep -qiE '(beta|alpha|rc|preview)'; then
8486
echo "tag=beta" >> "$GITHUB_OUTPUT"
8587
else
8688
echo "tag=latest" >> "$GITHUB_OUTPUT"
8789
fi
8890
fi
91+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
8992
9093
- name: Publish to npm
9194
working-directory: sdk/js

.github/workflows/python-sdk-release.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,31 @@ jobs:
3838
working-directory: sdk/python
3939
run: pdm build
4040

41-
- name: Parse version
41+
- name: Parse and verify version
4242
id: version
43-
run: echo "version=${GITHUB_REF_NAME#python-sdk-v}" >> "$GITHUB_OUTPUT"
43+
working-directory: sdk/python
44+
run: |
45+
PKG_VERSION=$(python -c "
46+
import re
47+
with open('pyproject.toml') as f:
48+
m = re.search(r'^version\s*=\s*\"([^\"]+)\"', f.read(), re.M)
49+
print(m.group(1) if m else '')
50+
")
51+
if [ -z "$PKG_VERSION" ]; then
52+
echo "::error::failed to parse version from pyproject.toml"
53+
exit 1
54+
fi
55+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
56+
VERSION="$PKG_VERSION"
57+
else
58+
TAG_VERSION="${GITHUB_REF_NAME#python-sdk-v}"
59+
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
60+
echo "::error::tag version ($TAG_VERSION) does not match pyproject.toml version ($PKG_VERSION)"
61+
exit 1
62+
fi
63+
VERSION="$TAG_VERSION"
64+
fi
65+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
4466
4567
- name: Publish to PyPI
4668
if: github.event_name == 'push' || github.event.inputs.target == 'pypi'

sdk/js/.claude/settings.local.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

sdk/js/.claude/settings.local.json.license

Lines changed: 0 additions & 3 deletions
This file was deleted.

sdk/js/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ node_modules/
22
dist/
33
*.log
44
package-lock.json
5+
.claude/settings.local.json
6+
.claude/settings.local.json.license

sdk/js/tsconfig.browser.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compilerOptions": {
44
"target": "es2020",
55
"module": "es2015",
6-
"lib": ["es2018", "dom"],
6+
"lib": ["es2020", "dom"],
77
"outDir": "./dist/browser",
88
"declaration": true,
99
"declarationMap": true,

sdk/js/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"target": "es2020",
44
"module": "commonjs",
5-
"lib": ["es2018"],
5+
"lib": ["es2020"],
66
"declaration": true,
77
"declarationMap": true,
88
"sourceMap": true,

sdk/js/tsconfig.node.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compilerOptions": {
44
"target": "es2020",
55
"module": "commonjs",
6-
"lib": ["es2018"],
6+
"lib": ["es2020"],
77
"outDir": "./dist/node",
88
"declaration": true,
99
"declarationMap": true,

0 commit comments

Comments
 (0)