(input: {
readonly tag: string;
readonly channel: ReleaseChannel;
readonly assetPaths: ReadonlyArray<string>;
})
| 192 | }; |
| 193 | |
| 194 | const syncGitHubRelease = async (input: { |
| 195 | readonly tag: string; |
| 196 | readonly channel: ReleaseChannel; |
| 197 | readonly assetPaths: ReadonlyArray<string>; |
| 198 | }): Promise<void> => { |
| 199 | if (!process.env.GH_TOKEN?.trim()) { |
| 200 | throw new Error("GH_TOKEN is required to create or update a GitHub release."); |
| 201 | } |
| 202 | |
| 203 | const repository = resolveGitHubRepository(); |
| 204 | |
| 205 | if (await githubReleaseExists(input.tag, repository)) { |
| 206 | await runCommand({ |
| 207 | command: "gh", |
| 208 | args: [ |
| 209 | "release", |
| 210 | "upload", |
| 211 | input.tag, |
| 212 | ...input.assetPaths, |
| 213 | "--repo", |
| 214 | repository, |
| 215 | "--clobber", |
| 216 | ], |
| 217 | cwd: repoRoot, |
| 218 | }); |
| 219 | return; |
| 220 | } |
| 221 | |
| 222 | const notes = await changelogSectionForVersion(input.tag.replace(/^v/, "")); |
| 223 | |
| 224 | // Draft until publish-desktop.yml finishes uploading installers and flips |
| 225 | // it; otherwise /releases/latest/download/<desktop-asset> 404s during the |
| 226 | // ~15-20 min desktop build window. |
| 227 | const args = [ |
| 228 | "release", |
| 229 | "create", |
| 230 | input.tag, |
| 231 | ...input.assetPaths, |
| 232 | "--repo", |
| 233 | repository, |
| 234 | "--title", |
| 235 | input.tag, |
| 236 | ...(notes ? ["--notes", notes] : ["--generate-notes"]), |
| 237 | "--verify-tag", |
| 238 | "--draft", |
| 239 | ]; |
| 240 | |
| 241 | if (input.channel === "beta") { |
| 242 | args.push("--prerelease"); |
| 243 | } |
| 244 | |
| 245 | await runCommand({ |
| 246 | command: "gh", |
| 247 | args, |
| 248 | cwd: repoRoot, |
| 249 | }); |
| 250 | }; |
| 251 |
no test coverage detected