Skip to content

Commit

Permalink
More deploy script faff
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Jun 25, 2021
1 parent 9847e81 commit 28298bd
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions deploy/deployChangedPackages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Assuming that this means we need to upload this package.`);
if (upload) {
if (process.env.NODE_AUTH_TOKEN) {
const publish = spawnSync("npm", ["publish", "--access", "public"], {
cwd: join(generatedDir, "packages", dirName),
cwd: join(generatedDir, dirName),
stdio: "inherit",
});

Expand All @@ -79,6 +79,11 @@ Assuming that this means we need to upload this package.`);

await createRelease(`${pkgJSON.name}@${pkgJSON.version}`);
}
} else {
console.log(
"Wanting to run: 'npm publish --access public' in " +
join(generatedDir, dirName)
);
}

uploaded.push(dirName);
Expand All @@ -103,12 +108,18 @@ async function createRelease(tag) {
const authToken = process.env.GITHUB_TOKEN || process.env.GITHUB_API_TOKEN;
const octokit = new Octokit({ auth: authToken });

await octokit.request("POST /repos/{owner}/{repo}/releases", {
owner: "microsoft",
repo: "TypeScript-DOM-lib-generator",
tag_name: tag,
target_commitish: process.env.GITHUB_SHA,
});
try {
await octokit.request("POST /repos/{owner}/{repo}/releases", {
owner: "microsoft",
repo: "TypeScript-DOM-lib-generator",
tag_name: tag,
target_commitish: process.env.GITHUB_SHA,
});
} catch (error) {
console.error(
"Creating the GitHub release failed, this is likely due to re-running the deploy."
);
}
}

go();

0 comments on commit 28298bd

Please sign in to comment.