diff --git a/.github/workflows/masterbot.yml b/.github/workflows/masterbot.yml index 1f76d317fc0..d431768fa9a 100644 --- a/.github/workflows/masterbot.yml +++ b/.github/workflows/masterbot.yml @@ -206,7 +206,8 @@ jobs: - name: Release run: | npm run nx:graph - npm run release:phase1-3 + npm run release:phase1 + npm run release:phase2 env: DEBUG: '*' IS_PRERELEASE: 'true' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index edfc0a2e2d2..ba03507d061 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -112,7 +112,7 @@ jobs: # registry-url: 'https://npm.pkg.github.com' # node-version-file: '.nvmrc' # - name: Publish to GitHub Packages - # run: npm run release:phase5 + # run: npm run release:phase4 # env: # NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # DEBUG: ${{ inputs.debug && '*' || '' }} diff --git a/.gitignore b/.gitignore index ece2173fac4..a386022b863 100644 --- a/.gitignore +++ b/.gitignore @@ -12,10 +12,9 @@ sarifs **.cy.ts.mp4 .cspellcache scripts/translation-gpt/temporary.json -.nx/cache # CI Release topology.json .git-message -.nx/cache packages/atomic/custom-elements.json +.nx \ No newline at end of file diff --git a/internal-docs/release-process.md b/internal-docs/release-process.md index 4cdb16f5875..7f30ca7dd6e 100644 --- a/internal-docs/release-process.md +++ b/internal-docs/release-process.md @@ -40,11 +40,13 @@ This task accomplishes its purpose by: 1. Committing a `.git-lock` file to the main branch. 2. Updating the repository's settings to enable "Require branches to be up to date before merging" for the main branch. -## `release:phase1` (bump package versions) +## `release:phase1` + +### Sub-phase 1: Bump package versions This task is run individually on every package, in topological order (dependencies first, then dependants). -The purpose of this task is to update the `package.json` file of every package to contain their new version and their new dependencies. This serves multiple purposes: +The purpose of this sub-phase is to update the `package.json` file of every package to contain their new version and their new dependencies. This serves multiple purposes: 1. NPM publishing. - When publishing packages to NPM, NPM determines the version of the package by looking at its `package.json` file. @@ -61,23 +63,17 @@ Additionally, this task will update the `CHANGELOG.md` file of the package to co This task does not make any changes to the `package-lock.json` file at the root of the repository, since doing so would cause [an error with NPM Workspaces](https://github.com/npm/cli/issues/5506). -## `release:build` (build bumped packages) - -This task is run individually on every package, immediately after `release:phase1`. - -The purpose of this task is to re-build a project right after it was bumped and before it gets published. This is needed because many packages contain information about their own version in their compiled code. +### Sub-phase 2: build -This task (and its dependencies) are automatically generated by `@coveo/nx-plugin`, which clones all `build` tasks and their respective dependencies. This is needed to ensure `release:build` depends on the current package's `release:phase1`. **Warning**: changes to `@coveo/nx-plugin` won't take effect until `npm install` is executed, which triggers Nx to rebuild its graph. +The purpose of this sub-phase is to re-build a project right after it was bumped and before it gets published. This is needed because many packages contain information about their own version in their compiled code. -## `release:phase2` (publish to NPM) - -This task is run individually on every package, immediately after `release:build`. +### Sub-phase 3: publish This workflow works on the assumption that we can't bump a package's version if any of its dependencies isn't published to NPM. The purpose of this task is to publish packages to NPM before dependant packages bump their versions. If a package is already published to NPM, this task will exit without error. After a package is published, this task will repeatedly query NPM until it confirms that the package exists in the registry. -## `release:phase3` (reify `package-lock.json`) +## `release:phase2` (reify `package-lock.json`) This task is run once at the root of the repository after every package's version was bumped. @@ -85,7 +81,7 @@ The purpose of this task is to re-generate the root `package-lock.json` file usi Scheduled releases will commit the new `package-lock.json` to the main branch, which ensures that contributors can run `npm install` without unnecessary changes being made to their `package-lock.json`. -## `release:phase4` (commit version bumps) +## `release:phase3` (commit version bumps) This task is only run for the scheduled release. @@ -98,12 +94,18 @@ This task will create a new "version bump" commit, which will contain: This task will also revert the changes from `release:phase0` to allow merging new features and fixes. -## `release:phase5` (publish to GitHub Packages) +## `release:phase4` (publish to GitHub Packages) + +> [!WARNING] +> Currently disabled. -This task will do the same thing as `release:phase2`, but is intended to publish the NPM package to GitHub Packages instead. +This task will do the same thing as `release:phase1`, sub-phase 3, but is intended to publish the NPM package to GitHub Packages instead. # Deploying +> [!NOTE] +> Probably out-of-date + After the release is completed on Git, GitHub and NPM, the release workflow will start a job on a Coveo-Hosted-runners to trigger the deployment pipeline. From there on, the process then follows this diagram (starting with 'Continue GitHub workflow on Coveo Hosted Runner): diff --git a/nx.json b/nx.json index ecda36b8fa9..a3ab67db235 100644 --- a/nx.json +++ b/nx.json @@ -98,16 +98,23 @@ "dependsOn": ["build"] }, "release:phase1": { - "dependsOn": ["^release:phase1", "^release:phase2"] - }, - "release:build": { - "dependsOn": ["^release:build", "release:phase1"] - }, - "release:phase2": { - "dependsOn": ["release:build", "release:phase1"] + "dependsOn": ["^release:phase1"], + "executor": "nx:run-commands", + "options": { + "commands": [ + "npm run publish:bump", + "npm run build", + "npm run publish:npm" + ], + "parallel": false, + "cwd": "{projectRoot}" + } }, - "release:phase5": { - "dependsOn": ["^release:phase5"] + "release:phase4": { + "dependsOn": ["^release:phase4"], + "//": "Currently disabled TODO KIT-3074", + "executor": "nx:noop", + "options": {"script": "publish:bump"} }, "cached:build:stencil": { "cache": true diff --git a/package-lock.json b/package-lock.json index 28e9a01f077..f719b2210bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -57418,7 +57418,7 @@ "devDependencies": { "@axe-core/playwright": "4.9.1", "@babel/core": "7.24.5", - "@coveo/atomic": "2.65.5", + "@coveo/atomic": "file:.", "@coveo/headless": "2.63.5", "@coveo/release": "1.0.0", "@custom-elements-manifest/analyzer": "0.10.2", diff --git a/package.json b/package.json index f5836665906..f2cdfa01516 100644 --- a/package.json +++ b/package.json @@ -17,13 +17,13 @@ "pre-commit": "lint-staged", "promote:npm:latest": "nx run-many --target=promote:npm:latest", "notify:docs": "node ./scripts/notify-docs/published-ui-kit.mjs", - "release": "npm run nx:graph && npm run release:phase0 && npm run release:phase1-3 && npm run release:phase4", + "release": "npm run nx:graph && npm run release:phase0 && npm run release:phase1 && npm run release:phase2 && npm run release:phase3", "nx:graph": "nx graph --file=topology.json", "release:phase0": "npm run-script -w=@coveo/release git-lock", - "release:phase1-3": "npm run release:phase2 && npm run-script -w=@coveo/release reify", - "release:phase2": "nx run-many --targets=release:phase2 --all --parallel=false --output-style=stream", - "release:phase4": "npm run-script -w=@coveo/release git-publish-all", - "release:phase5": "nx run-many --targets=release:phase5 --all" + "release:phase1": "nx run-many --targets=release:phase1 --all --parallel=false --output-style=stream", + "release:phase2": "npm run-script -w=@coveo/release reify", + "release:phase3": "npm run-script -w=@coveo/release git-publish-all", + "release:phase4": "nx run-many --targets=release:phase4 --all" }, "devDependencies": { "@actions/core": "1.10.1", diff --git a/packages/atomic-angular/package.json b/packages/atomic-angular/package.json index ad7247c21ec..4a823f2a03e 100644 --- a/packages/atomic-angular/package.json +++ b/packages/atomic-angular/package.json @@ -7,10 +7,8 @@ "build": "nx build", "build:bundles": "ng build", "build:assets": "ncp ../atomic/dist/atomic/assets projects/atomic-angular/dist/assets && ncp ../atomic/dist/atomic/lang projects/atomic-angular/dist/lang", - "release:phase1": "node ./scripts/bump.mjs", - "release:phase2": "npm run publish:npm", - "release:phase5": "npm run publish:npm", - "publish:npm": "node ./scripts/publish-npm.mjs" + "publish:npm": "node ./scripts/publish-npm.mjs", + "publish:bump": "node ./scripts/bump.mjs" }, "private": true, "dependencies": { diff --git a/packages/atomic-hosted-page/package.json b/packages/atomic-hosted-page/package.json index 746c17afc3b..fa9e738f3d3 100644 --- a/packages/atomic-hosted-page/package.json +++ b/packages/atomic-hosted-page/package.json @@ -26,10 +26,8 @@ "e2e:watch": "cypress open --browser chrome --e2e", "e2e": "cypress run --browser chrome", "validate:definitions": "tsc --noEmit --esModuleInterop --skipLibCheck ./dist/types/components.d.ts", - "release:phase1": "npm run-script -w=@coveo/release bump", - "release:phase2": "npm run publish:npm", - "release:phase5": "npm run publish:npm", "publish:npm": "npm run-script -w=@coveo/release npm-publish", + "publish:bump": "npm run-script -w=@coveo/release bump", "promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest" }, "dependencies": { diff --git a/packages/atomic-hosted-page/project.json b/packages/atomic-hosted-page/project.json index 9bdd15912db..e816aa7032b 100644 --- a/packages/atomic-hosted-page/project.json +++ b/packages/atomic-hosted-page/project.json @@ -10,6 +10,7 @@ ] }, "targets": { + "release:phase1": {}, "cached:build:stencil": { "dependsOn": ["^build"], "inputs": ["^production", "production"], diff --git a/packages/atomic-react/package.json b/packages/atomic-react/package.json index fb46a146bb1..b6b58f0c90b 100644 --- a/packages/atomic-react/package.json +++ b/packages/atomic-react/package.json @@ -15,10 +15,8 @@ "build:bundles:cjs": "tsc -p tsconfig.cjs.json", "build:bundles:iife": "rollup --config rollup.config.mjs", "build:bundles": "concurrently \"npm run build:bundles:esm\" \"npm run build:bundles:cjs\" \"npm run build:bundles:iife\"", - "release:phase1": "npm run-script -w=@coveo/release bump", - "release:phase2": "npm run publish:npm", - "release:phase5": "npm run publish:npm", "publish:npm": "npm run-script -w=@coveo/release npm-publish", + "publish:bump": "npm run-script -w=@coveo/release bump", "promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest", "build:assets": "ncp ../atomic/dist/atomic/assets dist/assets && ncp ../atomic/dist/atomic/lang dist/lang " }, diff --git a/packages/atomic-react/project.json b/packages/atomic-react/project.json index 567787e8dc4..5d391a98c5b 100644 --- a/packages/atomic-react/project.json +++ b/packages/atomic-react/project.json @@ -2,6 +2,7 @@ "name": "atomic-react", "$schema": "../../node_modules/nx/schemas/project-schema.json", "targets": { + "release:phase1": {}, "cached:build": { "dependsOn": ["^build", "clean"], "executor": "nx:run-commands", diff --git a/packages/atomic/package.json b/packages/atomic/package.json index b470c1ef844..89d72fd8010 100644 --- a/packages/atomic/package.json +++ b/packages/atomic/package.json @@ -41,10 +41,8 @@ "e2e:snapshots:watch": "cypress open --config-file cypress-screenshots.config.ts --browser chrome", "e2e:insight": "cypress run --config-file cypress-insight-panel.config.ts --browser chrome", "e2e:insight:watch": "cypress open --config-file cypress-insight-panel.config.ts --browser chrome", - "release:phase1": "npm run-script -w=@coveo/release bump", - "release:phase2": "npm run publish:npm", - "release:phase5": "npm run publish:npm", "publish:npm": "npm run-script -w=@coveo/release npm-publish", + "publish:bump": "npm run-script -w=@coveo/release bump", "promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest", "validate:definitions": "tsc --noEmit --esModuleInterop --skipLibCheck ./dist/types/components.d.ts" }, @@ -67,7 +65,7 @@ "devDependencies": { "@axe-core/playwright": "4.9.1", "@babel/core": "7.24.5", - "@coveo/atomic": "2.65.5", + "@coveo/atomic": "file:.", "@coveo/headless": "2.63.5", "@coveo/release": "1.0.0", "@custom-elements-manifest/analyzer": "0.10.2", diff --git a/packages/atomic/project.json b/packages/atomic/project.json index 4ce09b27976..af2134ea9ba 100644 --- a/packages/atomic/project.json +++ b/packages/atomic/project.json @@ -46,6 +46,7 @@ "script": "validate:definitions" } }, + "release:phase1": {}, "build": { "dependsOn": [ "cached:build:stencil", diff --git a/packages/auth/package.json b/packages/auth/package.json index 26b9e57287d..b6efd5d260e 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -19,10 +19,8 @@ "build:bundles": "node esbuild.mjs", "build:definitions": "tsc -p src/tsconfig.build.json -d --emitDeclarationOnly --declarationDir dist/definitions", "clean": "rimraf -rf dist/*", - "release:phase1": "npm run-script -w=@coveo/release bump", - "release:phase2": "npm run publish:npm", - "release:phase5": "npm run publish:npm", "publish:npm": "npm run-script -w=@coveo/release npm-publish", + "publish:bump": "npm run-script -w=@coveo/release bump", "promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest", "e2e": "npm run e2e:saml", "e2e:saml": "vite manual-e2e/saml/" diff --git a/packages/auth/project.json b/packages/auth/project.json index 1b09d50e9f1..d5824252340 100644 --- a/packages/auth/project.json +++ b/packages/auth/project.json @@ -2,6 +2,7 @@ "name": "auth", "$schema": "../../node_modules/nx/schemas/project-schema.json", "targets": { + "release:phase1": {}, "cached:build": { "executor": "nx:run-commands", "options": { diff --git a/packages/bueno/package.json b/packages/bueno/package.json index b5b446ad526..9cb72c3e8b7 100644 --- a/packages/bueno/package.json +++ b/packages/bueno/package.json @@ -25,10 +25,8 @@ "clean": "rimraf -rf dist/*", "test": "jest", "test:watch": "jest --watch --colors --no-cache", - "release:phase1": "npm run-script -w=@coveo/release bump", - "release:phase2": "npm run publish:npm", - "release:phase5": "npm run publish:npm", "publish:npm": "npm run-script -w=@coveo/release npm-publish", + "publish:bump": "npm run-script -w=@coveo/release bump", "promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest" }, "devDependencies": { diff --git a/packages/bueno/project.json b/packages/bueno/project.json index 3584f094f9e..d3cec81afb3 100644 --- a/packages/bueno/project.json +++ b/packages/bueno/project.json @@ -2,6 +2,7 @@ "name": "bueno", "$schema": "../../node_modules/nx/schemas/project-schema.json", "targets": { + "release:phase1": {}, "cached:build": { "executor": "nx:run-commands", "options": { diff --git a/packages/headless-react/package.json b/packages/headless-react/package.json index e2bb06fbb40..8267babb0e4 100644 --- a/packages/headless-react/package.json +++ b/packages/headless-react/package.json @@ -28,10 +28,8 @@ "test": "jest", "test:watch": "jest --watch --colors --no-cache", "lint": "eslint .; publint", - "release:phase1": "npm run-script -w=@coveo/release bump", - "release:phase2": "npm run publish:npm", - "release:phase5": "npm run publish:npm", "publish:npm": "npm run-script -w=@coveo/release npm-publish", + "publish:bump": "npm run-script -w=@coveo/release bump", "promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest" }, "dependencies": { diff --git a/packages/headless-react/project.json b/packages/headless-react/project.json index 58e0b7c55cf..d3a481dcd58 100644 --- a/packages/headless-react/project.json +++ b/packages/headless-react/project.json @@ -2,6 +2,7 @@ "name": "headless-react", "$schema": "../../node_modules/nx/schemas/project-schema.json", "targets": { + "release:phase1": {}, "cached:build": { "executor": "nx:run-commands", "options": { diff --git a/packages/headless/package.json b/packages/headless/package.json index 5e40f92903c..bcda7b1cdf3 100644 --- a/packages/headless/package.json +++ b/packages/headless/package.json @@ -36,10 +36,8 @@ "test:watch": "jest --watch --colors --no-cache --silent=false", "test:unit": "jest --testPathIgnorePatterns=src/integration-tests", "test:integration": "jest --testPathPattern=src/integration-tests", - "release:phase1": "npm run-script -w=@coveo/release bump", - "release:phase2": "npm run publish:npm", - "release:phase5": "npm run publish:npm", "publish:npm": "npm run-script -w=@coveo/release npm-publish", + "publish:bump": "npm run-script -w=@coveo/release bump", "promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest", "build:doc": "npm run build:doc:extract && npm run build:doc:parse", "build:doc:extract": "node ./scripts/extract-documentation.mjs", diff --git a/packages/headless/project.json b/packages/headless/project.json index 37e9f2db36f..84a368bee8c 100644 --- a/packages/headless/project.json +++ b/packages/headless/project.json @@ -9,6 +9,7 @@ ] }, "targets": { + "release:phase1": {}, "cached:build": { "outputs": [ "{projectRoot}/dist", diff --git a/packages/quantic/package.json b/packages/quantic/package.json index 194e618f111..564340c71f8 100644 --- a/packages/quantic/package.json +++ b/packages/quantic/package.json @@ -38,10 +38,8 @@ "publish:sfdx": "../../node_modules/.bin/ts-node scripts/build/create-package.ts --remove-translations", "promote:sfdx": "npm run publish:sfdx -- --promote", "promote:sfdx:ci": "npm run publish:sfdx -- --promote --ci", - "release:phase1": "npm run-script -w=@coveo/release bump", - "release:phase2": "npm run publish:npm", - "release:phase5": "npm run publish:npm", "publish:npm": "npm run-script -w=@coveo/release npm-publish", + "publish:bump": "npm run-script -w=@coveo/release bump", "promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest", "preinstall": "node scripts/npm/check-sfdx-project.js", "postinstall": "node scripts/npm/setup-quantic.js" diff --git a/packages/quantic/project.json b/packages/quantic/project.json index b45c15926c1..d69563b48d5 100644 --- a/packages/quantic/project.json +++ b/packages/quantic/project.json @@ -10,6 +10,7 @@ "negativeNonBuildOutputs": ["!{projectRoot}/reports"] }, "targets": { + "release:phase1": {}, "cached:build": { "outputs": [ "{projectRoot}/docs/out", diff --git a/patches/@coveo+semantic-monorepo-tools+2.4.31.patch b/patches/@coveo+semantic-monorepo-tools+2.4.31.patch new file mode 100644 index 00000000000..3197cc69786 --- /dev/null +++ b/patches/@coveo+semantic-monorepo-tools+2.4.31.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/@coveo/semantic-monorepo-tools/dist/git/getCommits.js b/node_modules/@coveo/semantic-monorepo-tools/dist/git/getCommits.js +index 302c25a..1bbd782 100644 +--- a/node_modules/@coveo/semantic-monorepo-tools/dist/git/getCommits.js ++++ b/node_modules/@coveo/semantic-monorepo-tools/dist/git/getCommits.js +@@ -13,7 +13,7 @@ export default async function (projectPath, from, to = "HEAD") { + const delimiter = `<--- ${randomBytes(64).toString("hex")} --->`; + const gitParams = [ + "log", +- `--pretty="format:%B%n-hash-%n%H ${delimiter}"`, ++ `--format=%B%n-hash-%n%H%n${delimiter}`, + "--dense", + `${from}..${to}`, + ].concat(getOptionalPositionalArgument(projectPath)); diff --git a/utils/release/bump-package.mjs b/utils/release/bump-package.mjs index 06e0a15a087..225c4c7918f 100755 --- a/utils/release/bump-package.mjs +++ b/utils/release/bump-package.mjs @@ -65,7 +65,10 @@ const modifyPackageJson = (packageDir, modifyPackageJsonCallback) => { readFileSync(packageJsonPath, {encoding: 'utf-8'}) ); const newPackageJson = modifyPackageJsonCallback(packageJson); - writeFileSync(packageJsonPath, JSON.stringify(newPackageJson || packageJson)); + writeFileSync( + packageJsonPath, + JSON.stringify(newPackageJson || packageJson, null, 2) + ); }; const isPrerelease = process.env.IS_PRERELEASE === 'true'; diff --git a/utils/release/reify.mjs b/utils/release/reify.mjs index f6932ba3ac2..ee5848f744d 100755 --- a/utils/release/reify.mjs +++ b/utils/release/reify.mjs @@ -51,6 +51,9 @@ function buildDependencyGraph(rootNode) { if (!node.package.name || !dependency.package.name) { throw 'Workspaces must all have a name.'; } + if (node.package.name === dependency.package.name) { + continue; + } graph.addDependency(node.package.name, dependency.package.name); addWorkspaceDependencies(dependency); }