(input: {
readonly tag: string;
readonly channel: ReleaseChannel;
readonly assetPaths: ReadonlyArray<string>;
})
| 217 | }; |
| 218 | |
| 219 | const syncGitHubRelease = async (input: { |
| 220 | readonly tag: string; |
| 221 | readonly channel: ReleaseChannel; |
| 222 | readonly assetPaths: ReadonlyArray<string>; |
| 223 | }): Promise<void> => { |
| 224 | if (!process.env.GH_TOKEN?.trim()) { |
| 225 | throw new Error("GH_TOKEN is required to create or update a GitHub release."); |
| 226 | } |
| 227 | |
| 228 | const repository = resolveGitHubRepository(); |
| 229 | |
| 230 | if (await githubReleaseExists(input.tag, repository)) { |
| 231 | await runCommand({ |
| 232 | command: "gh", |
| 233 | args: [ |
| 234 | "release", |
| 235 | "upload", |
| 236 | input.tag, |
| 237 | ...input.assetPaths, |
| 238 | "--repo", |
| 239 | repository, |
| 240 | "--clobber", |
| 241 | ], |
| 242 | cwd: repoRoot, |
| 243 | }); |
| 244 | return; |
| 245 | } |
| 246 | |
| 247 | const notes = await changelogSectionForVersion(input.tag.replace(/^v/, "")); |
| 248 | |
| 249 | // Draft until publish-desktop.yml finishes uploading installers and flips |
| 250 | // it; otherwise /releases/latest/download/<desktop-asset> 404s during the |
| 251 | // desktop build window. |
| 252 | const args = [ |
| 253 | "release", |
| 254 | "create", |
| 255 | input.tag, |
| 256 | ...input.assetPaths, |
| 257 | "--repo", |
| 258 | repository, |
| 259 | "--title", |
| 260 | input.tag, |
| 261 | ...(notes ? ["--notes", notes] : ["--generate-notes"]), |
| 262 | "--verify-tag", |
| 263 | "--draft", |
| 264 | ]; |
| 265 | |
| 266 | if (input.channel === "beta") { |
| 267 | args.push("--prerelease"); |
| 268 | } |
| 269 | |
| 270 | await runCommand({ |
| 271 | command: "gh", |
| 272 | args, |
| 273 | cwd: repoRoot, |
| 274 | }); |
| 275 | }; |
| 276 |
no test coverage detected