From 17f7f5aaef21941c2e1c07fd0b939d26f0eb51d6 Mon Sep 17 00:00:00 2001 From: Wilson Lin Date: Sun, 8 Aug 2021 18:06:17 +1000 Subject: [PATCH] Fix versioning script --- version | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/version b/version index 7551ef1..54ec2ec 100755 --- a/version +++ b/version @@ -5,6 +5,8 @@ const {readFileSync, writeFileSync} = require('fs'); const {spawnSync} = require('child_process'); +const RUST_MAIN_DIR = `${__dirname}/rust/main`; + const currentVersion = /^version = "(\d+)\.(\d+)\.(\d+)"\s*$/m.exec(readFileSync('Cargo.toml', 'utf8')).slice(1).map(n => Number.parseInt(n, 10)); const assertBetween = (n, min, max) => { @@ -67,7 +69,7 @@ if (cmd('git', 'status', '--porcelain', {throwOnStderr: true, captureStdio: true } cmd('git', 'pull'); cmd('bash', './prebuild.sh'); -cmd('cargo', 'test', '--features', 'js-esbuild'); +cmd('cargo', 'test', '--features', 'js-esbuild', {workingDir: RUST_MAIN_DIR}); for (const f of ['Cargo.toml', 'cli/Cargo.toml', 'nodejs/native/Cargo.toml', 'java/Cargo.toml', 'python/Cargo.core.toml', 'python/Cargo.js.toml', 'ruby/Cargo.toml']) { replaceInFile(f, /^version = "\d+\.\d+\.\d+"\s*$/m, `version = "${NEW_VERSION}"`); @@ -97,10 +99,10 @@ for (const f of ['ruby/minify_html.gemspec']) { replaceInFile(f, /^(\s*spec\.version\s*=\s*)"\d+\.\d+\.\d+"\s*$/m, `$1"${NEW_VERSION}"`); } -cmd('cargo', 'generate-lockfile'); +cmd('cargo', 'generate-lockfile', {workingDir: RUST_MAIN_DIR}); cmd('git', 'add', '-A'); cmd('git', 'commit', '-m', NEW_VERSION); cmd('git', 'tag', '-a', `v${NEW_VERSION}`, '-m', ''); // We have generated but ignored in `rust/common/gen`. -cmd('cargo', 'publish', '--allow-dirty'); +cmd('cargo', 'publish', '--allow-dirty', {workingDir: RUST_MAIN_DIR}); cmd('git', 'push', '--follow-tags');