Skip to content

fix(release): add-new-tooling #332

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

Merged
merged 43 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f507c5c
fix(pipeline): create-new-pipeline-for-publishing (#314)
Shreyas281299 Nov 19, 2024
10531f7
chore(release): 1.27.6-eft.1 [skip ci]
webex-components-publisher Nov 19, 2024
09e8912
fix(cc-store): try-patch-release (#315)
Shreyas281299 Nov 19, 2024
af2a9b8
chore(release): 1.27.6-eft.2 [skip ci]
webex-components-publisher Nov 19, 2024
9dd3461
feat(cc-user-state): try-minor-release (#316)
Shreyas281299 Nov 19, 2024
bb17741
chore(release): 1.28.0-eft.1 [skip ci]
webex-components-publisher Nov 19, 2024
20dfb7a
fix(release): update-files-that-are-published-to-npm (#317)
Shreyas281299 Nov 19, 2024
5daeeea
chore(release): 1.28.0-eft.2 [skip ci]
webex-components-publisher Nov 19, 2024
5d0a65e
fix(release): create-tag-without-npm-publish (#318)
Shreyas281299 Nov 19, 2024
445e8a7
chore(release): 1.28.0-eft.3 [skip ci]
webex-components-publisher Nov 19, 2024
7e20bec
fix(release): update-publishing-logic (#320)
Shreyas281299 Nov 20, 2024
7e28d02
chore(release): 1.28.0-eft.4 [skip ci]
webex-components-publisher Nov 20, 2024
3dc6f9f
fix(release): add-testing-step-in-circleci (#321)
Shreyas281299 Nov 20, 2024
3e11c58
chore(release): 1.28.0-eft.5 [skip ci]
webex-components-publisher Nov 20, 2024
e01591c
fix(release): fix-pr-checks (#322)
Shreyas281299 Nov 20, 2024
72b6672
chore(release): 1.28.0-eft.6 [skip ci]
webex-components-publisher Nov 20, 2024
25eb283
fix(release): change-changelog-md-file-location (#323)
Shreyas281299 Nov 20, 2024
4b87ffd
chore(release): 1.28.0-eft.7 [skip ci]
webex-components-publisher Nov 20, 2024
1c67f46
fix(release): wxcc-branch-specific-changes
ShreyasSharma28 Nov 20, 2024
eb6561e
fix(release): self-review
ShreyasSharma28 Nov 20, 2024
604e030
fix(release): formatting-changes
ShreyasSharma28 Nov 20, 2024
2d612b7
fix(release): update-config-yml
ShreyasSharma28 Nov 20, 2024
fb2cee0
fix(release): remove-publish-step-from-pipeline
ShreyasSharma28 Nov 20, 2024
7a7e976
fix(release): update-publish-to-get-name-from-packagejson
ShreyasSharma28 Nov 20, 2024
f36f2bb
fix(release): add-publish-logic-back-for-testing
ShreyasSharma28 Nov 20, 2024
754b02d
fix(release): check-pipeline-after-comments (#325)
Shreyas281299 Nov 20, 2024
a253f02
fix(release): remove-publish-step
ShreyasSharma28 Nov 20, 2024
f348033
fix(release): fix-tooling-ut
ShreyasSharma28 Nov 20, 2024
9e8926d
Eft test (#326)
Shreyas281299 Nov 20, 2024
9193b78
fix(release): testing-new-tooling (#327)
Shreyas281299 Nov 20, 2024
6675b3e
Updated config.yml
Shreyas281299 Nov 20, 2024
1c6e8ea
fix(release): run-pipeline-to-test-new-tooling (#328)
Shreyas281299 Nov 20, 2024
bd8d772
fix(release): review-comments
ShreyasSharma28 Nov 20, 2024
ecd70b0
fix(release): fix-ut-in-tooling (#329)
Shreyas281299 Nov 20, 2024
cd01914
chore(release): 1.28.0-eft.8 [skip ci]
webex-components-publisher Nov 20, 2024
e9e310b
fix(release): remove-unused-variable
ShreyasSharma28 Nov 21, 2024
50db292
fix(release): add-v-in-tagformat
ShreyasSharma28 Nov 21, 2024
2d080be
fix(release): test-new-changes
ShreyasSharma28 Nov 21, 2024
0dc540a
Merge remote-tracking branch 'upstream/eft' into eft-test
ShreyasSharma28 Nov 21, 2024
b2fd294
fix(release): test-release-with-vversion (#330)
Shreyas281299 Nov 21, 2024
143d250
Merge remote-tracking branch 'upstream/eft' into eft-test
ShreyasSharma28 Nov 21, 2024
05d67c9
Revert "fix(release): test-release-with-vversion (#330)"
ShreyasSharma28 Nov 21, 2024
dfacc65
feat(release): add-new-tooling
ShreyasSharma28 Nov 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 41 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
root: .
paths:
- node_modules
- packages/*/node_modules
- packages/**/*/node_modules

linter:
executor: node-executor
Expand All @@ -61,10 +61,13 @@ jobs:
- checkout_from_workspace
- run:
name: Build
command: yarn workspace @webex/widgets run build
command: yarn run build && yarn workspace @webex/widgets run build
- persist_to_workspace:
root: .
paths:
- packages/contact-center/station-login/dist
- packages/contact-center/store/dist
- packages/contact-center/user-state/dist
- packages/@webex/widgets/dist

docs:
Expand All @@ -87,6 +90,25 @@ jobs:
name: Release
command: yarn workspace @webex/widgets run release

unit_tests:
executor: node-executor
steps:
- checkout_from_workspace
- run:
name: Test Tooling
command: yarn run test:tooling
- run:
name: Test CC Widgets
command: yarn run test:cc-widgets

release_widgets:
executor: node-executor
steps:
- checkout_from_workspace
- run:
name: Release Widgets
command: yarn run release:widgets

# execute the jobs in an orderly manner
workflows:
setup_test_release:
Expand All @@ -98,19 +120,32 @@ workflows:
- build:
requires:
- linter
filters:
branches:
only: master

- docs:
requires:
- linter
filters:
branches:
only: master
only:
- master

- unit_tests:
requires:
- build

- release:
requires:
- build
- docs
filters:
branches:
only: master


- release_widgets:
requires:
- build
- unit_tests
filters:
branches:
only: eft
39 changes: 39 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"branches": [
"master",
{
"name": "eft",
"prerelease": "eft"
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "packages/contact-center/CHANGELOG.md"
}
],
[
"@semantic-release/exec",
{
"prepareCmd": "node ./tooling/src/publish.js ${nextRelease.channel} ${nextRelease.version} "
}
],
[
"@semantic-release/git",
{
"assets": [
"packages/contact-center/CHANGELOG.md",
"package.json",
"packages/contact-center/*/package.json"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
"tagFormat": "$v{nextRelease.version}"
}
],
"@semantic-release/github"
],
"tagFormat":"v${version}"
}
20 changes: 19 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,38 @@
],
"packageManager": "yarn@4.5.1",
"devDependencies": {
"@babel/preset-typescript": "7.25.9",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^11.0.1",
"html-webpack-plugin": "^5.6.3",
"jest": "29.7.0",
"node-gyp": "^10.2.0",
"semantic-release": "^24.2.0",
"typescript": "^5.6.3",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.1.0"
},
"scripts": {
"test:unit": "yarn run test:tooling && yarn run test:cc-widgets",
"test:tooling": "jest --coverage",
"test:cc-widgets": "yarn run test:store && yarn run test:widgets",
"test:store": "yarn workspace @webex/cc-store test:unit",
"test:widgets": "yarn workspace @webex/cc-station-login test:unit && yarn workspace @webex/cc-user-state test:unit",
"build": "yarn run build:store && yarn run build:widgets",
"build:store": "yarn workspace @webex/cc-store build:src",
"build:widgets": "yarn workspace @webex/cc-station-login build:src && yarn workspace @webex/cc-user-state build:src",
"samples:build": "yarn workspace @webex/react-samples-app build:src && yarn workspace @webex/web-component-samples-app build:src",
"samples:serve": "open docs/index.html && yarn workspace @webex/react-samples-app serve",
"samples:serve-react": "yarn workspace @webex/react-samples-app serve",
"samples:serve-wc": "yarn workspace @webex/web-component-samples-app serve"
"samples:serve-wc": "yarn workspace @webex/web-component-samples-app serve",
"release:widgets": "semantic-release"
},
"jest": {
"testMatch": [
"**/tooling/tests/*.js"
]
}
}
9 changes: 9 additions & 0 deletions packages/contact-center/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# [1.28.0-eft.8](https://github.com/webex/widgets/compare/1.28.0-eft.7...1.28.0-eft.8) (2024-11-20)


### Bug Fixes

* **release:** check-pipeline-after-comments ([#325](https://github.com/webex/widgets/issues/325)) ([754b02d](https://github.com/webex/widgets/commit/754b02dee16dbd6ad75c3c61affc2db594ce5b13))
* **release:** fix-ut-in-tooling ([#329](https://github.com/webex/widgets/issues/329)) ([ecd70b0](https://github.com/webex/widgets/commit/ecd70b083cecfe4e92aa1a0d029d608fd8d3a314))
* **release:** run-pipeline-to-test-new-tooling ([#328](https://github.com/webex/widgets/issues/328)) ([1c6e8ea](https://github.com/webex/widgets/commit/1c6e8ea7cdddb483f0c681f7683e48c2d973da5b))
* **release:** testing-new-tooling ([#327](https://github.com/webex/widgets/issues/327)) ([9193b78](https://github.com/webex/widgets/commit/9193b7832339f4289ef6f70d58554af04e57a6e3))
7 changes: 7 additions & 0 deletions packages/contact-center/station-login/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
"description": "Webex Contact Center Widgets: Station Login",
"version": "1.0.0",
"main": "dist/index.js",
"publishConfig": {
"access": "public"
},
"files": [
"dist/",
"package.json"
],
"scripts": {
"build": "yarn run -T tsc",
"build:src": "webpack && yarn run build",
Expand Down
10 changes: 9 additions & 1 deletion packages/contact-center/store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
"version": "1.0.0",
"main": "dist/index.js",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"files": [
"dist/",
"package.json"
],
"scripts": {
"build": "yarn run -T tsc",
"build:src": "webpack && yarn run build",
Expand Down Expand Up @@ -37,6 +44,7 @@
"webpack-merge": "6.0.1"
},
"jest": {
"testEnvironment": "jsdom"
"testEnvironment": "jsdom",
"passWithNoTests": true
}
}
10 changes: 9 additions & 1 deletion packages/contact-center/user-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
"description": "Webex Contact Center Widgets: User State",
"version": "1.0.0",
"main": "dist/index.js",
"publishConfig": {
"access": "public"
},
"files": [
"dist/",
"package.json"
],
"scripts": {
"build": "yarn run -T tsc",
"build:src": "webpack && yarn run build",
Expand Down Expand Up @@ -38,6 +45,7 @@
"webpack-merge": "6.0.1"
},
"jest": {
"testEnvironment": "jsdom"
"testEnvironment": "jsdom",
"passWithNoTests": true
}
}
91 changes: 91 additions & 0 deletions tooling/src/publish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
const {execSync} = require('child_process');
const fs = require('fs');
const path = require('path');

// Function to remove the 'stableVersion' key
function removeStableVersion(packageJsonPath, packageData) {
try {
if (packageData.hasOwnProperty('stableVersion')) {
delete packageData.stableVersion;
fs.writeFileSync(packageJsonPath, JSON.stringify(packageData, null, 2), 'utf-8');
console.log("'stableVersion' key removed successfully.");
} else {
console.log("'stableVersion' key does not exist in package.json.");
}
} catch (error) {
throw new Error("An error occurred while removing 'stableVersion':", error.message);
}
}

function versionAndPublish() {
const branchName = process.argv[2];
const newVersion = process.argv[3];

if (!branchName || !newVersion) {
console.error(
'Error: Not enough positional arguments provided! node <relative_path_to_publish> <branchName> <nextVersion>'
);
process.exit(1);
}
const contactCenterPath = './packages/contact-center';
const dependencies = ['@webex/cc-store'];

try {
const ccFolder = fs
.readdirSync(contactCenterPath, {withFileTypes: true})
.filter((dirent) => {
return dirent.isDirectory();
})
.map((dirent) => {
try {
const packageJsonPath = path.join(contactCenterPath, dirent.name, 'package.json');
const packageData = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));

console.log(`Removing stable version from package.json for ${dirent.name}`);
removeStableVersion(packageJsonPath, packageData);
return packageData.name;
} catch (error) {
throw new Error(`Error reading package.json in ${dirent.name}`, error);
}
});
// Separate dependency workspaces and other workspaces
const dependencyWorkspaces = ccFolder.filter((fileName) => dependencies.includes(fileName));

const otherWorkspaces = ccFolder.filter((fileName) => !dependencies.includes(fileName));

const publishWorkspace = (workspaceName) => {
console.log(`Running publish script for ${workspaceName}: ${newVersion}`);

// ccFolder has names of all the packages like @webex/cc-store and the actual folder name is just store,
// thats why we need to remove '@webex/cc-' from the workspaceName to ge the path
const packageJsonPath = path.join(contactCenterPath, workspaceName.replace('@webex/cc-', ''), 'package.json');

console.log(`Publishing new version for ${workspaceName}: ${newVersion}`);

// Update version in the workspace
execSync(`yarn workspace ${workspaceName} version ${newVersion}`, {stdio: 'inherit'});

// Publish the package
// execSync(`yarn workspace ${workspaceName} npm publish --tag ${branchName}`, {stdio: 'inherit'});

execSync(`yarn workspace ${workspaceName} pack`, {stdio: 'inherit'});
};

// Publish dependencies first
dependencyWorkspaces.forEach(publishWorkspace);

// Publish other packages
otherWorkspaces.forEach(publishWorkspace);
} catch (error) {
console.error(`Failed to process workspaces:`, error.message);
process.exit(1);
}
}

// Only execute when called through a module/script
if (require.main !== module) {
// Export the function for testing
module.exports = {versionAndPublish};
} else {
versionAndPublish();
}
Loading