mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-17 23:11:16 +00:00
feat(release): implement semantic versioning automation with conventional commits
- Add semantic-release for automated npm publishing - Add commitlint + husky for commit message enforcement - Add professional branching strategy (beta → main workflow) - Create .releaserc.json with multi-branch config - Create sync-version-plugin.cjs for VERSION file sync - Update release.yml workflow (Node.js 22 required) - Update CLAUDE.md and CONTRIBUTING.md with new workflow - Deprecate manual bump-version.sh script
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* semantic-release plugin to sync VERSION file
|
||||
*
|
||||
* semantic-release updates package.json but not the VERSION file.
|
||||
* This plugin keeps VERSION in sync for shell scripts and installers.
|
||||
*/
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Called during the prepare step before git commit
|
||||
*/
|
||||
prepare(_pluginConfig, context) {
|
||||
const { nextRelease, logger } = context;
|
||||
const versionFile = path.join(process.cwd(), 'VERSION');
|
||||
|
||||
// Write version without 'v' prefix (e.g., "5.1.0" not "v5.1.0")
|
||||
const version = nextRelease.version;
|
||||
fs.writeFileSync(versionFile, version + '\n');
|
||||
logger.log('[sync-version-plugin] Updated VERSION file to %s', version);
|
||||
|
||||
// Also update installers for standalone installs
|
||||
const installSh = path.join(process.cwd(), 'installers', 'install.sh');
|
||||
const installPs1 = path.join(process.cwd(), 'installers', 'install.ps1');
|
||||
|
||||
if (fs.existsSync(installSh)) {
|
||||
let content = fs.readFileSync(installSh, 'utf8');
|
||||
content = content.replace(/^CCS_VERSION=".*"/m, `CCS_VERSION="${version}"`);
|
||||
fs.writeFileSync(installSh, content);
|
||||
logger.log('[sync-version-plugin] Updated installers/install.sh');
|
||||
}
|
||||
|
||||
if (fs.existsSync(installPs1)) {
|
||||
let content = fs.readFileSync(installPs1, 'utf8');
|
||||
content = content.replace(/^\$CcsVersion = ".*"/m, `$CcsVersion = "${version}"`);
|
||||
fs.writeFileSync(installPs1, content);
|
||||
logger.log('[sync-version-plugin] Updated installers/install.ps1');
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user