-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: specify version when invoking deployment pipeline (#4637)
https://coveord.atlassian.net/browse/KIT-3692 This PR specifies _a version_ when invoking the deployment pipeline. This is necessary since we deploy from two separate branches. The pipeline needs a better way to differentiate those two. This version will be the root pjson.version starting from 3.0.0 for v3 and 2.0.0 for v2. - [x] tested the script locally --------- Co-authored-by: Louis Bompart <lbompart@coveo.com>
- Loading branch information
1 parent
2eefb48
commit 700aed2
Showing
4 changed files
with
40 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env node | ||
import { | ||
getCurrentVersion, | ||
getNextVersion, | ||
} from '@coveo/semantic-monorepo-tools'; | ||
import {readFileSync, writeFileSync} from 'node:fs'; | ||
import {resolve} from 'node:path'; | ||
|
||
if (!process.env.INIT_CWD) { | ||
throw new Error('Should be called using npm run-script'); | ||
} | ||
process.chdir(process.env.INIT_CWD); | ||
|
||
(async () => { | ||
const PATH = '.'; | ||
|
||
console.log('Bumping root package.json version'); | ||
const currentVersion = getCurrentVersion(PATH); | ||
const nextVersion = getNextVersion(currentVersion, {type: 'patch'}); | ||
|
||
const packageJsonPath = resolve(PATH, 'package.json'); | ||
const packageJson = JSON.parse( | ||
readFileSync(packageJsonPath, {encoding: 'utf-8'}) | ||
); | ||
packageJson.version = nextVersion; | ||
|
||
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2)); | ||
console.log(`Updated root package version to ${nextVersion}`); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters