Improve version number derivation (#3822)

This commit is contained in:
Chris Estreich 2025-05-21 23:59:18 -07:00 committed by GitHub
parent 39cd50b989
commit 568fb875fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,12 +38,14 @@ jobs:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Count commits
id: count
run: echo "total=$(git rev-list --all --count)" >> $GITHUB_OUTPUT
- name: Forge numeric Nightly version
id: version
env:
RUN_NUMBER: ${{ github.run_number }}
run: echo "number=$(( 5500 + ${RUN_NUMBER} ))" >> $GITHUB_OUTPUT
- name: Patch package.json version
env:
COMMIT_COUNT: ${{ steps.count.outputs.total }}
VERSION_NUMBER: ${{ steps.version.outputs.number }}
run: |
node <<'EOF'
const fs = require('fs');
@ -51,7 +53,7 @@ jobs:
const pkgPath = path.join(__dirname, 'apps', 'vscode-nightly', 'package.nightly.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath,'utf8'));
const [maj, min] = pkg.version.split('.');
pkg.version = `${maj}.${min}.${process.env.COMMIT_COUNT}`;
pkg.version = `${maj}.${min}.${process.env.VERSION_NUMBER}`;
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
console.log(`🔖 Nightly version set to ${pkg.version}`);
EOF