convert version bump to use pwsh

This commit is contained in:
jeffvli 2025-10-11 14:15:03 -07:00
parent cc466cb0f4
commit f14d1f3c5c

View file

@ -26,30 +26,31 @@ jobs:
run: pnpm install run: pnpm install
- name: Bump version and add beta suffix - name: Bump version and add beta suffix
shell: pwsh
run: | run: |
# Get current version from package.json # Get current version from package.json
CURRENT_VERSION=$(node -p "require('./package.json').version") $currentVersion = (Get-Content package.json | ConvertFrom-Json).version
echo "Current version: $CURRENT_VERSION" Write-Host "Current version: $currentVersion"
# Extract major, minor, patch components # Extract major, minor, patch components
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" $versionParts = $currentVersion.Split('.')
$major = [int]$versionParts[0]
$minor = [int]$versionParts[1]
$patch = [int]$versionParts[2]
# Increment patch version # Increment patch version
NEW_PATCH=$((PATCH + 1)) $newPatch = $patch + 1
# Create new version with beta suffix # Create new version with beta suffix
NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}-beta" $newVersion = "$major.$minor.$newPatch-beta"
echo "New version: $NEW_VERSION" Write-Host "New version: $newVersion"
# Update package.json # Update package.json
node -e " $packageJson = Get-Content package.json | ConvertFrom-Json
const fs = require('fs'); $packageJson.version = $newVersion
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); $packageJson | ConvertTo-Json -Depth 10 | Set-Content package.json
pkg.version = '$NEW_VERSION';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 4) + '\n');
"
echo "Updated package.json version to: $NEW_VERSION" Write-Host "Updated package.json version to: $newVersion"
# - name: Build and Publish releases (Windows) # - name: Build and Publish releases (Windows)
# if: matrix.os == 'windows-latest' # if: matrix.os == 'windows-latest'