Skip to content

Commit

Permalink
Upload dist archive for all releases (#3125)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoluc authored Sep 12, 2023
1 parent 8f0075b commit cb87df4
Showing 1 changed file with 25 additions and 28 deletions.
53 changes: 25 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,33 @@ jobs:
let errorMessage;
for (const { name, version } of publishedPackages) {
const tag = `${name}@${version}`;
// Only upload the dist archive for the core package, plugins, and extensions
if (name === "jspsych" || name.includes("/plugin-") || name.includes("/extension-")) {
console.log(`Uploading dist archive release asset for ${tag}`);
try {
// https://docs.github.com/en/rest/reference/repos#get-a-release-by-tag-name
const releaseId = (
await github.request("GET /repos/{owner}/{repo}/releases/tags/{tag}", {
owner,
repo,
tag,
})
).data.id;
// https://octokit.github.io/rest.js/v18#repos-upload-release-asset
await github.repos.uploadReleaseAsset({
console.log(`Uploading dist archive release asset for ${tag}`);
try {
// https://docs.github.com/en/rest/reference/repos#get-a-release-by-tag-name
const releaseId = (
await github.request("GET /repos/{owner}/{repo}/releases/tags/{tag}", {
owner,
repo,
release_id: releaseId,
name: `jspsych.zip`,
label: "Dist archive (zip)",
headers: {
"content-type": "application/zip",
"content-length": fs.statSync(distFile).size,
},
data: fs.readFileSync(distFile),
});
} catch (error) {
console.log(error);
errorMessage = error.message;
}
tag,
})
).data.id;
// https://octokit.github.io/rest.js/v18#repos-upload-release-asset
await github.repos.uploadReleaseAsset({
owner,
repo,
release_id: releaseId,
name: `jspsych.zip`,
label: "Dist archive (zip)",
headers: {
"content-type": "application/zip",
"content-length": fs.statSync(distFile).size,
},
data: fs.readFileSync(distFile),
});
} catch (error) {
console.log(error);
errorMessage = error.message;
}
}
Expand Down

0 comments on commit cb87df4

Please sign in to comment.