Skip to content

Commit 1587e9f

Browse files
ev-scCopilot
andauthored
Update .github/workflows/publish-sdk.yml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9cccbb7 commit 1587e9f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/publish-sdk.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,18 @@ jobs:
167167
- name: Update SDK version
168168
working-directory: ts-mapped-sdk
169169
run: |
170-
# Read current version or default to 0.0.0
171-
if [ -f package.json ]; then
170+
# Read current version from the committed SDK package.json (HEAD),
171+
# falling back to the working copy or 0.0.0 if necessary.
172+
if git show HEAD:package.json >/tmp/original_package.json 2>/dev/null; then
173+
CURRENT_VERSION=$(node -p "require('/tmp/original_package.json').version || '0.0.0'")
174+
elif [ -f package.json ]; then
172175
CURRENT_VERSION=$(node -p "require('./package.json').version || '0.0.0'")
173176
else
174177
CURRENT_VERSION="0.0.0"
175178
fi
176179
177180
# Bump patch version
178-
NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')
181+
NEW_VERSION=$(echo "$CURRENT_VERSION" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')
179182
180183
# Update package.json with new version
181184
node -e "

0 commit comments

Comments
 (0)