diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04c4d672a77..ae375200071 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,8 +18,6 @@ on: jobs: release: environment: 'Release' - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} runs-on: ubuntu-latest steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 @@ -45,3 +43,12 @@ jobs: RELEASER_CLIENT_SECRET: ${{ secrets.RELEASER_CLIENT_SECRET }} RELEASER_INSTALLATION_ID: ${{ secrets.RELEASER_INSTALLATION_ID }} DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - uses: actions/setup-node@v3 + with: + registry-url: 'https://npm.pkg.github.com' + node-version-file: '.nvmrc' + - name: Publish to GitHub Packages + run: npm run release:phase5 + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/internal-docs/release-process.md b/internal-docs/release-process.md index b6577377110..e080c4b05bd 100644 --- a/internal-docs/release-process.md +++ b/internal-docs/release-process.md @@ -98,6 +98,10 @@ 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) + +This task will do the same thing as `release:phase2`, but is intended to publish the NPM package to GitHub Packages instead. + # Deploying Whenever a new version bump is pushed to the main branch by the scheduled release process, the Jenkins CI will run the `Jenkinsfile` on it. diff --git a/internal-docs/scripts-and-tasks.md b/internal-docs/scripts-and-tasks.md index 85a1d0ba500..62c380ad09a 100644 --- a/internal-docs/scripts-and-tasks.md +++ b/internal-docs/scripts-and-tasks.md @@ -141,6 +141,10 @@ Does the same thing as the `test` script, except: - Does the same thing as the `test:watch` script, but runs end-to-end tests instead. +### `publish:npm` script + +- Publishes the package to NPM. + ### `publish:sfdx` script - Publishes the package to the current Salesforce dev hub. diff --git a/nx.json b/nx.json index 08cae6e55fb..2124ed35bcc 100644 --- a/nx.json +++ b/nx.json @@ -107,6 +107,9 @@ }, "release:phase2": { "dependsOn": ["release:build", "release:phase1"] + }, + "release:phase5": { + "dependsOn": ["^release:phase5"] } }, "defaultBase": "master", diff --git a/package.json b/package.json index fb3aeef5212..3652319d527 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,10 @@ "release": "npm run nx:graph && npm run release:phase0 && npm run release:phase1-3 && npm run release:phase4", "nx:graph": "nx graph --file=topology.json", "release:phase0": "npx -p=@coveo/release git-lock", - "release:phase1-3": "nx run-many --targets=release:phase2 --all --parallel=false --output-style=stream && npx -p=@coveo/release reify", - "release:phase4": "npx -p=@coveo/release git-publish-all" + "release:phase1-3": "npm run release:phase2 && npx -p=@coveo/release reify", + "release:phase2": "nx run-many --targets=release:phase2 --all --parallel=false --output-style=stream", + "release:phase4": "npx -p=@coveo/release git-publish-all", + "release:phase5": "nx run-many --targets=release:phase5 --all" }, "devDependencies": { "@actions/core": "1.10.1", diff --git a/packages/atomic-angular/package.json b/packages/atomic-angular/package.json index 655aa849369..cccb8b895e7 100644 --- a/packages/atomic-angular/package.json +++ b/packages/atomic-angular/package.json @@ -7,7 +7,9 @@ "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:phase2": "node ./scripts/release-phase2.mjs" + "release:phase2": "npm run publish:npm", + "release:phase5": "npm run publish:npm", + "publish:npm": "node ./scripts/publish-npm.mjs" }, "private": true, "dependencies": { diff --git a/packages/atomic-angular/project.json b/packages/atomic-angular/project.json index 380d58705f0..33d9528b1ae 100644 --- a/packages/atomic-angular/project.json +++ b/packages/atomic-angular/project.json @@ -25,14 +25,6 @@ "command": "npx -p=@coveo/release bump", "cwd": "packages/atomic-angular/projects/atomic-angular" } - }, - "release:phase2": { - "executor": "nx:run-commands", - "options": { - "commands": ["npm run release:phase2"], - "parallel": false, - "cwd": "packages/atomic-angular" - } } } } diff --git a/packages/atomic-angular/scripts/release-phase2.mjs b/packages/atomic-angular/scripts/publish-npm.mjs similarity index 100% rename from packages/atomic-angular/scripts/release-phase2.mjs rename to packages/atomic-angular/scripts/publish-npm.mjs diff --git a/packages/atomic-hosted-page/package.json b/packages/atomic-hosted-page/package.json index 8d91cdc612d..4d18be37124 100644 --- a/packages/atomic-hosted-page/package.json +++ b/packages/atomic-hosted-page/package.json @@ -27,7 +27,9 @@ "e2e": "cypress run --browser chrome", "validate:definitions": "tsc --noEmit --esModuleInterop --skipLibCheck ./dist/types/components.d.ts", "release:phase1": "npx -p=@coveo/release bump", - "release:phase2": "npx -p=@coveo/release npm-publish", + "release:phase2": "npm run publish:npm", + "release:phase5": "npm run publish:npm", + "publish:npm": "npx -p=@coveo/release npm-publish", "promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest" }, "dependencies": { diff --git a/packages/atomic-react/package.json b/packages/atomic-react/package.json index 2657dd8d2c9..d4ff2367c85 100644 --- a/packages/atomic-react/package.json +++ b/packages/atomic-react/package.json @@ -16,7 +16,9 @@ "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": "npx -p=@coveo/release bump", - "release:phase2": "npx -p=@coveo/release npm-publish", + "release:phase2": "npm run publish:npm", + "release:phase5": "npm run publish:npm", + "publish:npm": "npx -p=@coveo/release npm-publish", "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/package.json b/packages/atomic/package.json index a8a09a0776f..00a45d9f2c0 100644 --- a/packages/atomic/package.json +++ b/packages/atomic/package.json @@ -42,7 +42,9 @@ "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": "npx -p=@coveo/release bump", - "release:phase2": "npx -p=@coveo/release npm-publish", + "release:phase2": "npm run publish:npm", + "release:phase5": "npm run publish:npm", + "publish:npm": "npx -p=@coveo/release npm-publish", "promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest", "validate:definitions": "tsc --noEmit --esModuleInterop --skipLibCheck ./dist/types/components.d.ts" }, diff --git a/packages/auth/package.json b/packages/auth/package.json index 457fbc2c4cb..1a2ad0effa5 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -20,7 +20,9 @@ "build:definitions": "tsc -p src/tsconfig.build.json -d --emitDeclarationOnly --declarationDir dist/definitions", "clean": "rimraf -rf dist/*", "release:phase1": "npx -p=@coveo/release bump", - "release:phase2": "npx -p=@coveo/release npm-publish", + "release:phase2": "npm run publish:npm", + "release:phase5": "npm run publish:npm", + "publish:npm": "npx -p=@coveo/release npm-publish", "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/bueno/package.json b/packages/bueno/package.json index ea36acf3492..3139a2a51a5 100644 --- a/packages/bueno/package.json +++ b/packages/bueno/package.json @@ -26,7 +26,9 @@ "test": "jest", "test:watch": "jest --watch --colors --no-cache", "release:phase1": "npx -p=@coveo/release bump", - "release:phase2": "npx -p=@coveo/release npm-publish", + "release:phase2": "npm run publish:npm", + "release:phase5": "npm run publish:npm", + "publish:npm": "npx -p=@coveo/release npm-publish", "promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest" }, "devDependencies": { diff --git a/packages/headless-react/package.json b/packages/headless-react/package.json index 673221af0db..49d3d8a6c92 100644 --- a/packages/headless-react/package.json +++ b/packages/headless-react/package.json @@ -29,7 +29,9 @@ "test:watch": "jest --watch --colors --no-cache", "lint": "eslint .; publint", "release:phase1": "npx -p=@coveo/release bump", - "release:phase2": "npx -p=@coveo/release npm-publish", + "release:phase2": "npm run publish:npm", + "release:phase5": "npm run publish:npm", + "publish:npm": "npx -p=@coveo/release npm-publish", "promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest" }, "dependencies": { diff --git a/packages/headless/package.json b/packages/headless/package.json index 55fa8f9d617..f241c3cae26 100644 --- a/packages/headless/package.json +++ b/packages/headless/package.json @@ -37,7 +37,9 @@ "test:unit": "jest --testPathIgnorePatterns=src/integration-tests", "test:integration": "jest --testPathPattern=src/integration-tests", "release:phase1": "npx -p=@coveo/release bump", - "release:phase2": "npx -p=@coveo/release npm-publish", + "release:phase2": "npm run publish:npm", + "release:phase5": "npm run publish:npm", + "publish:npm": "npx -p=@coveo/release npm-publish", "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/quantic/package.json b/packages/quantic/package.json index 577b655cfbc..1d06aead464 100644 --- a/packages/quantic/package.json +++ b/packages/quantic/package.json @@ -37,7 +37,9 @@ "promote:sfdx": "npm run publish:sfdx -- --promote", "promote:sfdx:ci": "npm run publish:sfdx -- --promote --ci", "release:phase1": "npx -p=@coveo/release bump", - "release:phase2": "npx -p=@coveo/release npm-publish", + "release:phase2": "npm run publish:npm", + "release:phase5": "npm run publish:npm", + "publish:npm": "npx -p=@coveo/release npm-publish", "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/utils/release/npm-publish-package.mjs b/utils/release/npm-publish-package.mjs index 1407f96dada..cb6e713954a 100755 --- a/utils/release/npm-publish-package.mjs +++ b/utils/release/npm-publish-package.mjs @@ -41,4 +41,6 @@ if (!(await isPublished(name, version))) { }, {retries: 30} ); +} else { + console.log(`Version ${version} is already published.`); }