(version: string, gitTag: string, isDryRun: boolean)
| 231 | } |
| 232 | |
| 233 | async function createGithubRelease(version: string, gitTag: string, isDryRun: boolean) { |
| 234 | const [owner, repo] = process.env.GITHUB_REPOSITORY!.split('/'); |
| 235 | const isPrerelease = !!semver.prerelease(version); |
| 236 | |
| 237 | const ghUrl = 'POST /repos/{owner}/{repo}/releases'; |
| 238 | const ghData = { |
| 239 | owner, |
| 240 | repo, |
| 241 | tag_name: gitTag, |
| 242 | prerelease: isPrerelease, |
| 243 | generate_release_notes: true, |
| 244 | }; |
| 245 | console.log(` ${ghUrl} ${JSON.stringify(ghData)}`, isDryRun ? '(dry-run)' : ''); |
| 246 | |
| 247 | if (!isDryRun) { |
| 248 | // https://docs.github.com/en/rest/reference/repos#create-a-release |
| 249 | const octokit = new Octokit(); |
| 250 | await octokit.request(ghUrl, ghData); |
| 251 | console.log( |
| 252 | `🐋 created github release "${gitTag}": https://github.com/${owner}/${repo}/releases` |
| 253 | ); |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | export async function checkExistingNpmVersion(pkgName: string, newVersion: string) { |
| 258 | if (newVersion !== '0.0.1') { |
no outgoing calls
no test coverage detected
searching dependent graphs…