Fix versioning script
This commit is contained in:
parent
b47c730d86
commit
17f7f5aaef
8
version
8
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');
|
||||
|
|
Loading…
Reference in New Issue