Skip to content

Commit fea7141

Browse files
committed
feat: update install script to sync the Docker file image to the package version on release
1 parent 58c8ac8 commit fea7141

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

scripts/update-install-script-version.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,28 @@ const __dirname = path.dirname(__filename);
1111

1212
const readmePath = path.join(__dirname, '../README.md');
1313
const installScriptPath = path.join(__dirname, './install.sh');
14+
const dockerfilePath = path.join(__dirname, '../ci/image.Dockerfile');
1415

1516
let readme = fs.readFileSync(readmePath, 'utf8');
1617
let installScript = fs.readFileSync(installScriptPath, 'utf8');
18+
let dockerfile = fs.readFileSync(dockerfilePath, 'utf8');
1719

1820
// Regex to match version string inside /cli/v{{version}}/scripts/
1921
const versionInInstallReadme = /(\/cli\/)v\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(\/scripts\/)/g;
2022

2123
// Regex to match the LATEST_VERSION defined in the install.sh script
2224
const versionInInstallScript = /(LATEST_VERSION=")v\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(")/g;
2325

26+
// Regex to match ARG VERSION=<version> in the Dockerfile
27+
const versionInDockerfile = /(ARG VERSION=)\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?/g;
28+
2429
readme = readme.replace(versionInInstallReadme, `$1v${newVersion}$2`);
2530
fs.writeFileSync(readmePath, readme);
2631

2732
installScript = installScript.replace(versionInInstallScript, `$1v${newVersion}$2`);
2833
fs.writeFileSync(installScriptPath, installScript);
2934

35+
dockerfile = dockerfile.replace(versionInDockerfile, `$1${newVersion}`);
36+
fs.writeFileSync(dockerfilePath, dockerfile);
37+
3038
console.log(`Updated install script and install command with ${newVersion}`);

0 commit comments

Comments
 (0)