Skip to content

Commit

Permalink
Create upload avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
dappnodedev committed Aug 6, 2024
1 parent 7d9dd53 commit 4227b13
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/tasks/createGithubRelease/subtasks/getCreateReleaseTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,7 @@ async function uploadAssets({
const releaseEntries = Object.entries(releaseDetailsMap);
const [, { releaseDir: firstReleaseDir }] = releaseEntries[0];

// Upload the avatar
await github.uploadReleaseAssets({
releaseId,
assetsDir: firstReleaseDir,
matchPattern: /.*\.png/,
}).catch((e) => {
console.error(`Error uploading avatar from ${firstReleaseDir}`, e);
});
await uploadAvatar({ github, releaseId, avatarDir: firstReleaseDir });

for (const [dnpName, { releaseDir }] of releaseEntries) {
const shortDnpName = dnpName.split(".")[0];
Expand All @@ -118,6 +111,25 @@ async function uploadAssets({
}
}

async function uploadAvatar({
github,
releaseId,
avatarDir
}: {
github: Github;
releaseId: number;
avatarDir: string;
}): Promise<void> {
await github.uploadReleaseAssets({
releaseId,
assetsDir: avatarDir,
matchPattern: /.*\.png/,
}).catch((e) => {
console.error(`Error uploading avatar from ${avatarDir}`, e);
});
}


/**
* Write the release body
*
Expand Down

0 comments on commit 4227b13

Please sign in to comment.