Skip to content

Commit

Permalink
workflow(cd): Update release.js (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ananya54321 authored Oct 17, 2024
1 parent ee521e3 commit 874549c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ async function main() {
'config',
'--global',
'user.name',
'github-actions[bot]',
process.env.GIT_USER_NAME || 'github-actions[bot]',
]);
await run('git', [
'config',
'--global',
'user.email',
'github-actions[bot]@users.noreply.github.com',
process.env.GIT_USER_EMAIL || 'github-actions[bot]@users.noreply.github.com',
]);
}
step('\nCommitting changes...');
Expand Down Expand Up @@ -90,8 +90,11 @@ async function main() {
}
} catch (error) {
console.error(chalk.red(`Error during release process: ${error.message}`));
await cleanup();
process.exit(1); // Exit with failure
}

await cleanup(); // Ensure cleanup after successful execution
}

async function build() {
Expand Down Expand Up @@ -207,6 +210,16 @@ async function writeNpmrc() {
}
}

async function cleanup() {
try {
step('\nCleaning up...');
await run('rm', ['-rf', 'dist']);
} catch (error) {
console.error(chalk.red('Error during cleanup'));
throw error;
}
}

main().catch((err) => {
console.error(chalk.red(`Unexpected error: ${err.message}`));
process.exit(1);
Expand Down

0 comments on commit 874549c

Please sign in to comment.