|
8 | 8 |
|
9 | 9 | import { InternalOptions } from "../options-mapping"; |
10 | 10 | import { BuildContext } from "../types"; |
11 | | -import { createRelease } from "./api"; |
12 | 11 | import { addSpanToTransaction } from "./telemetry"; |
13 | 12 |
|
14 | | -export async function createNewRelease( |
15 | | - options: InternalOptions, |
16 | | - ctx: BuildContext |
17 | | -): Promise<string> { |
| 13 | +export async function createNewRelease(options: InternalOptions, ctx: BuildContext): Promise<void> { |
18 | 14 | const span = addSpanToTransaction(ctx, "function.plugin.create_release"); |
19 | 15 |
|
20 | 16 | // TODO: pull these checks out of here and simplify them |
21 | 17 | if (options.authToken === undefined) { |
22 | 18 | ctx.logger.warn('Missing "authToken" option. Will not create release.'); |
23 | | - return Promise.resolve("nothing to do here"); |
| 19 | + return; |
24 | 20 | } else if (options.org === undefined) { |
25 | 21 | ctx.logger.warn('Missing "org" option. Will not create release.'); |
26 | | - return Promise.resolve("nothing to do here"); |
| 22 | + return; |
27 | 23 | } else if (options.url === undefined) { |
28 | 24 | ctx.logger.warn('Missing "url" option. Will not create release.'); |
29 | | - return Promise.resolve("nothing to do here"); |
| 25 | + return; |
30 | 26 | } else if (options.project === undefined) { |
31 | 27 | ctx.logger.warn('Missing "project" option. Will not create release.'); |
32 | | - return Promise.resolve("nothing to do here"); |
| 28 | + return; |
33 | 29 | } |
34 | 30 |
|
35 | | - await createRelease({ |
36 | | - release: options.release, |
37 | | - authToken: options.authToken, |
38 | | - org: options.org, |
39 | | - project: options.project, |
40 | | - sentryUrl: options.url, |
41 | | - sentryHub: ctx.hub, |
42 | | - customHeader: options.customHeader, |
43 | | - }); |
| 31 | + await ctx.cli.releases.new(options.release); |
44 | 32 |
|
45 | 33 | ctx.logger.info("Successfully created release."); |
46 | 34 |
|
47 | 35 | span?.finish(); |
48 | | - return Promise.resolve("nothing to do here"); |
49 | 36 | } |
50 | 37 |
|
51 | 38 | export async function uploadSourceMaps(options: InternalOptions, ctx: BuildContext): Promise<void> { |
|
0 commit comments