Skip to content
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

workflow(cd): Implement Cleanup Functionality for Temporary Files #124

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
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
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
Loading