Skip to content

chore(ci): fix regression regarding emptyDir #306

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

Merged
merged 3 commits into from
Mar 29, 2022
Merged
Changes from 2 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
13 changes: 11 additions & 2 deletions scripts/release/process-release.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* eslint-disable no-console */
import fsp from 'fs/promises';
import path from 'path';

import dotenv from 'dotenv';
import execa from 'execa';
import { emptyDir, copy } from 'fs-extra';
import { copy, remove } from 'fs-extra';
import semver from 'semver';
import type { ReleaseType } from 'semver';

Expand Down Expand Up @@ -110,6 +111,14 @@ async function updateOpenApiTools(
);
}

async function emptyDirExceptForDotGit(dir: string): Promise<void> {
for await (const file of await fsp.readdir(dir)) {
if (file !== '.git') {
await remove(path.resolve(dir, file));
}
}
}

async function updateChangelog({
lang,
issueBody,
Expand Down Expand Up @@ -206,7 +215,7 @@ async function processRelease(): Promise<void> {
});

const clientPath = toAbsolutePath(getLanguageFolder(lang));
await emptyDir(tempGitDir);
await emptyDirExceptForDotGit(tempGitDir);
await copy(clientPath, tempGitDir, { preserveTimestamps: true });

await configureGitHubAuthor(tempGitDir);
Expand Down