forked from webex/widgets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(release): create-release-pipeline (webex#306)
Co-authored-by: Shreyas Sharma <shreysh2@cisco.com>
- Loading branch information
1 parent
09961ba
commit 29bc449
Showing
13 changed files
with
1,497 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"branches": [ | ||
"master", | ||
{ | ||
"name": "eft-pipeline", | ||
"prerelease": "eft-pipeline" | ||
} | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/changelog", | ||
[ | ||
"@semantic-release/exec", | ||
{ | ||
"prepareCmd": "node publish.js @webex/cc-store eft-pipeline" | ||
} | ||
], | ||
[ | ||
"@semantic-release/exec", | ||
{ | ||
"prepareCmd": "node publish.js @webex/cc-station-login eft-pipeline" | ||
} | ||
], | ||
[ | ||
"@semantic-release/exec", | ||
{ | ||
"prepareCmd": "node publish.js @webex/cc-user-state eft-pipeline" | ||
} | ||
], | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": [ | ||
"CHANGELOG.md", | ||
"package.json", | ||
"packages/contact-center/*/package.json" | ||
], | ||
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}", | ||
"tagFormat": "${nextRelease.version}" | ||
} | ||
], | ||
"@semantic-release/github" | ||
], | ||
"tagFormat":"${version}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
/* | ||
* StationLogin helper | ||
*/ | ||
export const useStationLogin = () => { | ||
return {name: 'StationLogin'}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
export interface IStationLoginProps { | ||
/** | ||
* The name of the station. | ||
* | ||
*/ | ||
name: string; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
/* | ||
* UserState helpers | ||
*/ | ||
|
||
export const useUserState = () => { | ||
return {name: 'UserState'}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const {execSync} = require('child_process'); | ||
const path = require('path'); | ||
|
||
// Define the versionAndPublish function | ||
function versionAndPublish(workspaceName) { | ||
try { | ||
let version; | ||
const branchName = process.argv[3]; | ||
|
||
try { | ||
// Fetch the existing version from npm | ||
version = execSync(`npm view ${workspaceName} dist-tags.${branchName}`, {stdio: 'pipe'}) | ||
.toString() | ||
.trim(); | ||
} catch (npmError) { | ||
// If no package is found (npm view fails), log a message and continue | ||
console.log(`No existing version found for ${workspaceName}. Creating a new version.`); | ||
version = ''; | ||
} | ||
|
||
let newVersion; | ||
if (!version) { | ||
newVersion = `1.28.0-${branchName}.1`; | ||
} else { | ||
// Increment the patch number | ||
const baseVersion = parseInt(version.split('.').pop(), 10); | ||
newVersion = `1.28.0-${branchName}.${baseVersion + 1}`; | ||
} | ||
|
||
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'}); | ||
} catch (error) { | ||
console.error(`Failed to process workspace ${workspaceName}:`, error.message); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
// Get the workspace name from command-line arguments | ||
const workspaceName = process.argv[2]; | ||
|
||
if (!workspaceName) { | ||
console.error('Error: Workspace name must be provided!'); | ||
process.exit(1); | ||
} | ||
|
||
// Call the versionAndPublish function with the workspace name | ||
versionAndPublish(workspaceName); | ||
|
||
module.exports = versionAndPublish; |
Oops, something went wrong.