Skip to content

Commit

Permalink
fix: check if there are changes to commit in the tag script
Browse files Browse the repository at this point in the history
- Code formatting
- Fix variable name
  • Loading branch information
Desvelao committed Jul 13, 2023
1 parent 27eb944 commit a532593
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions scripts/release/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ async function run(configuration) {

function execSystem(command) {
logger.info(`Run command: ${command}`);
execSync(command);
return execSync(command);
}

for (const platformID in supportedVersions) {
Expand All @@ -384,21 +384,33 @@ async function run(configuration) {

const tag = `v${version}-${pluginPlatformVersion}${tagSuffix}`;
logger.info(`Generating tag: ${tag}...`);

logger.info(`Calling to bump script`);
const configuratioBump = {
logger.info('Calling to bump script');
const configurationBump = {
...configuration,
manifestPlugin: manifestPluginPath,
platformVersion: pluginPlatformVersion,
};
logger.debug(
`Configuration to use with the bump script: ${configuratioBump}`,
`Configuration to use with the bump script: ${configurationBump}`,
);

bump(configuratioBump);
bump(configurationBump);

logger.debug('Checking if there are changes to commit');
const thereChangesToCommit =
execSystem('git diff --exit-code --no-patch;echo -n $?').toString() ===
'1';
logger.debug(`Are there changes to commit?: ${thereChangesToCommit}`);

if (thereChangesToCommit) {
logger.info('There are changes to commit.');
logger.debug('Commiting');
execSystem(`git commit -am "Bump ${tag}"`);
logger.info('Commited');
} else {
logger.info('There are not changes to commit.');
}

logger.debug(`Commiting`);
execSystem(`git commit -am "Bump ${tag}"`);
logger.info(`Commited`);
logger.debug(`Creating tag: ${tag}`);
execSystem(
`git tag -a ${tag} -m "Wazuh ${version} for ${platformID} ${pluginPlatformVersion}"`,
Expand Down

0 comments on commit a532593

Please sign in to comment.