Skip to content

Commit

Permalink
chore: promote the v2 branch when publishing on v2 (#4584)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-bompart authored Oct 23, 2024
1 parent 6b6979e commit 49d1d3e
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 95 deletions.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"outputs": [],
"executor": "nx:run-commands",
"options": {
"command": "node ../../../../scripts/deploy/update-npm-tag.mjs v2-latest",
"command": "npm run-script -w=@coveo/release promote-npm-prod",
"cwd": "packages/atomic-angular/projects/atomic-angular"
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/atomic-hosted-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"validate:definitions": "tsc --noEmit --esModuleInterop --skipLibCheck ./dist/types/components.d.ts",
"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 v2-latest"
"promote:npm:latest": "npm run-script -w=@coveo/release promote-npm-prod"
},
"dependencies": {
"@coveo/bueno": "0.46.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/atomic-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"build:bundles": "concurrently \"npm run build:bundles:esm\" \"npm run build:bundles:cjs\" \"npm run build:bundles:iife\"",
"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 v2-latest",
"promote:npm:latest": "npm run-script -w=@coveo/release promote-npm-prod",
"build:assets": "ncp ../atomic/dist/atomic/assets dist/assets && ncp ../atomic/dist/atomic/lang dist/lang "
},
"main": "./dist/cjs/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/atomic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"e2e:insight:watch": "cypress open --config-file cypress-insight-panel.config.ts --browser chrome",
"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 v2-latest",
"promote:npm:latest": "npm run-script -w=@coveo/release promote-npm-prod",
"validate:definitions": "tsc --noEmit --esModuleInterop --skipLibCheck ./dist/types/components.d.ts"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/bueno/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"test:watch": "jest --watch --colors --no-cache",
"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 v2-latest"
"promote:npm:latest": "npm run-script -w=@coveo/release promote-npm-prod"
},
"devDependencies": {
"@coveo/release": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/headless-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"lint": "eslint .; publint",
"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 v2-latest"
"promote:npm:latest": "npm run-script -w=@coveo/release promote-npm-prod"
},
"dependencies": {
"@coveo/headless": "2.80.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/headless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"test:integration": "jest --testPathPattern=src/integration-tests",
"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 v2-latest",
"promote:npm:latest": "npm run-script -w=@coveo/release promote-npm-prod",
"build:doc": "npm run build:doc:extract && npm run build:doc:parse",
"build:doc:extract": "node ./scripts/extract-documentation.mjs",
"build:doc:parse": "ts-node --project ./doc-parser/tsconfig.build.json ./doc-parser/doc-parser.ts"
Expand Down
2 changes: 1 addition & 1 deletion packages/quantic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"promote:sfdx:ci": "npm run publish:sfdx -- --promote --ci",
"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 v2-latest",
"promote:npm:latest": "npm run-script -w=@coveo/release promote-npm-prod",
"preinstall": "node scripts/npm/check-sfdx-project.js",
"postinstall": "node scripts/npm/setup-quantic.js"
},
Expand Down
33 changes: 0 additions & 33 deletions patches/@coveo+semantic-monorepo-tools+2.4.43.patch

This file was deleted.

49 changes: 0 additions & 49 deletions scripts/deploy/update-npm-tag.mjs

This file was deleted.

1 change: 1 addition & 0 deletions utils/release/common/constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ export const RELEASER_AUTH_SECRETS = {
installationId: process.env.RELEASER_INSTALLATION_ID,
};

export const NPM_LATEST_TAG = 'v2-latest';
export const NPM_BETA_TAG = 'v2-beta';
export const NPM_ALPHA_TAG = 'v2-alpha';
3 changes: 2 additions & 1 deletion utils/release/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "1.0.0",
"type": "module",
"dependencies": {
"@coveo/semantic-monorepo-tools": "2.4.43",
"@coveo/semantic-monorepo-tools": "2.5.0",
"@npmcli/arborist": "7.5.4",
"@octokit/auth-app": "6.1.1",
"async-retry": "1.3.3",
Expand All @@ -22,6 +22,7 @@
"typescript": "5.4.5"
},
"scripts": {
"promote-npm-prod": "./promote-npm-tag-to-latest.mjs",
"git-lock": "./git-lock.mjs",
"bump": "./bump-package.mjs",
"npm-publish": "./npm-publish-package.mjs",
Expand Down
25 changes: 25 additions & 0 deletions utils/release/promote-npm-tag-to-latest.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env node
import {describeNpmTag, npmSetTag} from '@coveo/semantic-monorepo-tools';
import {readFileSync} from 'node:fs';
import {gt} from 'semver';
import {NPM_LATEST_TAG} from './common/constants.mjs';

if (!process.env.INIT_CWD) {
throw new Error('Should be called using npm run-script');
}
process.chdir(process.env.INIT_CWD);

const {name, version} = JSON.parse(
readFileSync('package.json', {encoding: 'utf-8'})
);

const publishedVersion = await describeNpmTag(name, NPM_LATEST_TAG);

if (gt(publishedVersion, version)) {
console.log(
`skipping tag update for ${name} because version "${version}" is not greater than latest version "${publishedVersion}".`
);
process.exit(1);
}

await npmSetTag(name, version, NPM_LATEST_TAG);

0 comments on commit 49d1d3e

Please sign in to comment.