Skip to content

Commit d31f5d9

Browse files
committed
Updating build.
1 parent 6d5c9c1 commit d31f5d9

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,23 @@ jobs:
6666
- name: Compile extension
6767
run: npm run vscode:prepublish
6868

69-
- name: Determine version suffix
69+
- name: Determine build metadata
7070
id: version
7171
run: |
7272
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
73-
echo "suffix=" >> $GITHUB_OUTPUT
7473
echo "release_type=release" >> $GITHUB_OUTPUT
7574
elif [ "${{ github.ref }}" = "refs/heads/debug" ]; then
76-
echo "suffix=-debug" >> $GITHUB_OUTPUT
77-
echo "release_type=debug" >> $GITHUB_OUTPUT
75+
echo "release_type=beta" >> $GITHUB_OUTPUT
7876
fi
7977
echo "sha_short=$(echo ${{ github.sha }} | cut -c1-8)" >> $GITHUB_OUTPUT
8078
8179
- name: Update package.json version for non-main builds
82-
if: github.ref != 'refs/heads/main'
80+
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/v')
8381
run: |
84-
# Get current version and append build info
85-
CURRENT_VERSION=$(node -p "require('./package.json').version")
86-
NEW_VERSION="${CURRENT_VERSION}${{ steps.version.outputs.suffix }}-${GITHUB_RUN_NUMBER}+${{ steps.version.outputs.sha_short }}"
87-
npm version "$NEW_VERSION" --no-git-tag-version
82+
# Build strict numeric version: major.minor.patch.run
83+
BASE_VERSION=$(node -p "(() => { const m = (require('./package.json').version.match(/\\d+/g) || []); return [m[0] || '0', m[1] || '0', m[2] || '0'].join('.'); })()")
84+
NEW_VERSION="${BASE_VERSION}.${GITHUB_RUN_NUMBER}"
85+
node -e "const fs=require('fs');const p=require('./package.json');p.version=process.env.NEW_VERSION;fs.writeFileSync('package.json', JSON.stringify(p, null, 2) + '\\n');"
8886
echo "Updated version to: $NEW_VERSION"
8987
9088
- name: Package extension

0 commit comments

Comments
 (0)