-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: add prerelease #2553
ci: add prerelease #2553
Conversation
/** | ||
* @typedef {import('../packages.mjs').PackageDefinition} PackageDefinition | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the JSDoc equivalent to import type { PackageDefinition } from '../packages';
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice touch
) | ||
.join('\n'); | ||
const message = `${lernaMessageSection}\n\n${updatedPackagesMessageSection}`; | ||
await execute('git', ['commit', '--no-verify', '-m', message]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this, and multi-line commits work.
Pull Request Report PR Title ✅ Title follows the conventional commit spec. Bundle Size
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing seems particularly wrong, tho there's too many things for me to judge/give an approve given my limited knowledge of your CI/CD
export function updatePackageVersion( | ||
packageName, | ||
newVersion, | ||
depdendenciesPackageDirs | ||
) { | ||
depdendenciesPackageDirs.forEach((packageDir) => { | ||
const fullPath = resolve('.', 'packages', packageDir, 'package.json'); | ||
const originalContentAsText = readFileSync(fullPath).toString(); | ||
let newContent = originalContentAsText.replace( | ||
new RegExp(`("${packageName.replace('/', '\\/')}"\\s*:\\s*")([^"]*)`), | ||
'$1' + newVersion | ||
); | ||
if (packageName === JSON.parse(originalContentAsText).name) { | ||
newContent = newContent.replace( | ||
/("version"\s*:\s*\")([^"]*)/, | ||
'$1' + newVersion | ||
); | ||
} | ||
writeFileSync(fullPath, newContent); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not parse, edit then, write? It'll be more maintainable than a RegExp nah?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I should've clarified this part. Unfortunately, parsing, editing then reformatting gives a pretty ugly JSON, and I wanted to maintain the current structure of the JSON.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param {readonly string[]} [args] | ||
* @returns {Promise<string>} | ||
*/ | ||
export function execute(command, args = []) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a package to do this type of thing? I feel like it's a bit out of our scope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to see the command & output of every command in the console while also being able to use the output, which by default isn't the case with spawn
and exec
(setting stdio: 'inherit'
makes them return nothing). I could've tried a bunch of third-party exec
libraries to do it, but it doesn't seem to be worth the time exploring them, and this is a fairly simple utility function that mostly just wraps the native spawn
function.
Nice work! It would be nice to update the readme for upcoming pre-releases. Some nitpick: doing the refactor to modules in the same PR as adding the pre-release specific code & the migration from Lerna... it will make it hard to discern changes when looking back. These kind of things were a bit annoying when fixing something in the dep. process in the past. I'd wait for Olivier's feedback too before merging |
Agreed, I ideally would've liked to do it separately, but unfortunately I wasn't able to use the semantic monorepo tools with commonJS. |
What if it was
|
We can do that, but in this case PR1 may be as big as this PR (possibly bigger since we'd need to add changelogs and conventional graduating). It would be more consistent across both releases though. Is this what you prefer? |
PR1: cjs -> mjs |
I'm merging this in
master
since in theory it shouldn't affect it. Changes from #2548 were copied here.New prerelease process
To start a major prerelease (e.g.,
1.2.3
→2.0.0-pre.0
):master
.prerelease/
(e.g.,prerelease/headless_atomic_v2
)npm run bump:version:major-prerelease -- @coveo/package1 @coveo/package2 @coveo/package3
.Updating a prerelease branch:
master
to reference a version bump.master
into the prerelease branch.Adding new changes to the prerelease branch:
Officially releasing (e.g.,
2.0.0-pre.15
→2.0.0
):-pre.
suffix)master
.Changes in this PR
bump:version:major-prerelease
script to the rootpackage.json
lerna
gives version bumps, including[skip-ci]
.prerelease/**
branch now trigger the same CI asmaster
, except:/pre\.[0-9]+$/
are upgraded.prerelease/**
branch now trigger the same CI asmaster
, except:/pre\.[0-9]+$/
are published to NPM.alpha
tag on NPM isn't updated.dev
environment.execSync
were replaced with a utilityexecute
functionexecute
, in addition to returning its output, copies stdout & stderr to the console to make debugging easier. I caught some issues early thanks to this.Other details
major
/minor
/patch
version, the prerelease version will be ignored. Therefor,2.0.0
will already be available on the dev CDN, and will be overwritten every time we update the prerelease. Out of scope packages will also update their CDN, but in theory the files should be the same anyway.https://coveord.atlassian.net/browse/KIT-2114