Skip to content

Commit

Permalink
chore(ci): fix regression regarding emptyDir (#306)
Browse files Browse the repository at this point in the history
* chore(ci): fix regression regarding emptyDir

* chore: fix import order problem

* Update scripts/release/process-release.ts

Co-authored-by: Pierre Millot <pierre.millot@algolia.com>

Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
  • Loading branch information
eunjae-lee and millotp authored Mar 29, 2022
1 parent e7999f5 commit 86c8200
Showing 1 changed file with 11 additions and 2 deletions.
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 (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

0 comments on commit 86c8200

Please sign in to comment.