Update release.yml
This commit is contained in:
parent
5703b44a5d
commit
777caec00f
1 changed files with 22 additions and 16 deletions
38
.github/workflows/release.yml
vendored
38
.github/workflows/release.yml
vendored
|
@ -158,26 +158,32 @@ jobs:
|
|||
release = releaseData;
|
||||
}
|
||||
|
||||
const distPath = path.join(process.cwd(), 'artifacts');
|
||||
const files = await fs.readdir(distPath);
|
||||
|
||||
for (const file of files) {
|
||||
const filePath = path.join(distPath, file);
|
||||
const stats = await fs.stat(filePath);
|
||||
let uploadCount = 0;
|
||||
|
||||
async function uploadFilesRecursively(dir) {
|
||||
const entries = await fs.readdir(dir, { withFileTypes: true });
|
||||
|
||||
if (stats.isFile()) {
|
||||
console.log(`Uploading ${file} to release...`);
|
||||
await github.rest.repos.uploadReleaseAsset({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
release_id: release.id,
|
||||
name: file,
|
||||
data: await fs.readFile(filePath)
|
||||
});
|
||||
for (const entry of entries) {
|
||||
const fullPath = path.join(dir, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
await uploadFilesRecursively(fullPath);
|
||||
} else {
|
||||
console.log(`Uploading ${entry.name} to release...`);
|
||||
await github.rest.repos.uploadReleaseAsset({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
release_id: release.id,
|
||||
name: entry.name,
|
||||
data: await fs.readFile(fullPath)
|
||||
});
|
||||
uploadCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log('All assets uploaded successfully.');
|
||||
const artifactsPath = path.join(process.cwd(), 'artifacts');
|
||||
await uploadFilesRecursively(artifactsPath);
|
||||
console.log(`Successfully uploaded ${uploadCount} assets to the release.`);
|
||||
|
||||
deploy:
|
||||
name: "Deploy to Production"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue