chore: bump version to 1.0.4

This commit is contained in:
Jason Jafari 2024-06-13 23:38:54 -04:00
parent ba88aeda9f
commit c470615bd3
7 changed files with 121 additions and 8 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npm run healthy-check
npm run increase-version
git add package.json
# npm run healthy-check
# npm run increase-version
# git add package.json

64
increaseVersion.ts Executable file
View File

@ -0,0 +1,64 @@
#!/usr/bin/env bun
const fs = require("fs");
const path = require("path");
function incrementVersion(version) {
let [major, minor, patch] = version.split(".").map(Number);
patch += 1;
if (patch >= 10) {
patch = 0;
minor += 1;
if (minor >= 10) {
minor = 0;
major += 1;
}
}
return `${major}.${minor}.${patch}`;
}
function updateSetupPy(newVersion) {
const setupPyPath = path.join(__dirname, "setup.py");
let setupPyContent = fs.readFileSync(setupPyPath, "utf8");
setupPyContent = setupPyContent.replace(
/version=['"](\d+\.\d+\.\d+)['"]/,
`version='${newVersion}'`
);
fs.writeFileSync(setupPyPath, setupPyContent, "utf8");
}
function updatePackageJson(newVersion) {
const packageJsonPath = path.join(__dirname, "package.json");
const packageJsonContent = JSON.parse(
fs.readFileSync(packageJsonPath, "utf8")
);
packageJsonContent.version = newVersion;
fs.writeFileSync(
packageJsonPath,
JSON.stringify(packageJsonContent, null, 2),
"utf8"
);
}
function main() {
const setupPyPath = path.join(__dirname, "setup.py");
const setupPyContent = fs.readFileSync(setupPyPath, "utf8");
const currentVersionMatch = setupPyContent.match(
/version=['"](\d+\.\d+\.\d+)['"]/
);
if (!currentVersionMatch) {
console.error("Failed to find version in setup.py");
process.exit(1);
}
const currentVersion = currentVersionMatch[1];
const newVersion = incrementVersion(currentVersion);
updateSetupPy(newVersion);
updatePackageJson(newVersion);
console.log(`Version updated to ${newVersion}`);
}
main();

View File

@ -1,6 +1,6 @@
{
"name": "mlModelSaver",
"version": "1.0.2",
"version": "1.0.4",
"description": "Make life easier for save and serving ml models",
"main": "index.js",
"repository": "git@github.com:smartdev-ca/mlModelSaver.git",
@ -11,8 +11,9 @@
"husky": "^9.0.11"
},
"scripts": {
"increase-version": "npm --force --no-git-tag-version version patch",
"increase-version": "./increaseVersion.ts",
"releaseNewVersionAndAddTag": "./releaseNewVersionAndAddTag.sh",
"healthy-check": "ls -la",
"prepare": "husky install"
}
}
}

21
releaseNewVersionAndAddTag.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
./increaseVersion.ts
new_version=$(node -p "require('./package.json').version")
python setup.py sdist bdist_wheel
twine upload dist/*
git add .
git commit -m "chore: bump version to $new_version"
git tag -a "v$new_version" -m "Version $new_version"
git push origin main
git push origin "v$new_version"
echo "Version updated to $new_version, committed, and pushed with tag v$new_version"

View File

@ -9,7 +9,6 @@ jaraco.functools==4.0.1
keyring==25.2.1
markdown-it-py==3.0.0
mdurl==0.1.2
-e git+ssh://git@github.com/smartdev-ca/mlModelSaver.git@a0fb6ac93d247e7aba3c2b1f901db279e782e996#egg=mlModelSaver
more-itertools==10.3.0
nh3==0.2.17
pkginfo==1.11.1

View File

@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name='mlModelSaver',
version='1.0.1',
version='1.0.4',
packages=find_packages(),
description='Make life easier for save and serving ml models',
author='Jason Jafari',

28
tsconfig.json Normal file
View File

@ -0,0 +1,28 @@
{
"compilerOptions": {
"jsx": "react-jsx",
"module": "CommonJS",
"target": "ES6",
"moduleResolution": "node",
"resolveJsonModule": true,
"allowJs": true,
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noImplicitAny": false,
"baseUrl": ".",
"paths": {
"@common/*": ["./common/*"],
"@helpers/*": ["./helpers/*"],
},
"types": [
"node"
]
},
"exclude": [
"node_modules",
"dist"
]
}