UNPKG

7.42 kBTypeScriptView Raw
1/// <reference types="node" />
2import { OutgoingHttpHeaders } from "http";
3export declare type PublishProvider = "github" | "bintray" | "s3" | "spaces" | "generic" | "custom" | "snapStore";
4export declare type AllPublishOptions = string | GithubOptions | S3Options | SpacesOptions | GenericServerOptions | BintrayOptions | CustomPublishOptions;
5export interface PublishConfiguration {
6 /**
7 * The provider.
8 */
9 readonly provider: PublishProvider;
10 /**
11 * @private
12 * win-only
13 */
14 publisherName?: Array<string> | null;
15 /**
16 * @private
17 * win-only
18 */
19 readonly updaterCacheDirName?: string | null;
20 /**
21 * Whether to publish auto update info files.
22 *
23 * Auto update relies only on the first provider in the list (you can specify several publishers).
24 * Thus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.
25 *
26 * @default true
27 */
28 readonly publishAutoUpdate?: boolean;
29 /**
30 * Any custom request headers
31 */
32 readonly requestHeaders?: OutgoingHttpHeaders;
33}
34export interface CustomPublishOptions extends PublishConfiguration {
35 [index: string]: any;
36}
37/**
38 * [GitHub](https://help.github.com/articles/about-releases/) options.
39 *
40 * GitHub [personal access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) is required. You can generate by going to [https://github.com/settings/tokens/new](https://github.com/settings/tokens/new). The access token should have the repo scope/permission.
41 * Define `GH_TOKEN` environment variable.
42 */
43export interface GithubOptions extends PublishConfiguration {
44 /**
45 * The provider. Must be `github`.
46 */
47 readonly provider: "github";
48 /**
49 * The repository name. [Detected automatically](#github-repository-and-bintray-package).
50 */
51 readonly repo?: string | null;
52 /**
53 * The owner.
54 */
55 readonly owner?: string | null;
56 /**
57 * Whether to use `v`-prefixed tag name.
58 * @default true
59 */
60 readonly vPrefixedTagName?: boolean;
61 /**
62 * The host (including the port if need).
63 * @default github.com
64 */
65 readonly host?: string | null;
66 /**
67 * The protocol. GitHub Publisher supports only `https`.
68 * @default https
69 */
70 readonly protocol?: "https" | "http" | null;
71 /**
72 * The access token to support auto-update from private github repositories. Never specify it in the configuration files. Only for [setFeedURL](/auto-update#appupdatersetfeedurloptions).
73 */
74 readonly token?: string | null;
75 /**
76 * Whether to use private github auto-update provider if `GH_TOKEN` environment variable is defined. See [Private GitHub Update Repo](/auto-update#private-github-update-repo).
77 */
78 readonly private?: boolean | null;
79 /**
80 * The type of release. By default `draft` release will be created.
81 *
82 * Also you can set release type using environment variable. If `EP_DRAFT`is set to `true` — `draft`, if `EP_PRE_RELEASE`is set to `true` — `prerelease`.
83 * @default draft
84 */
85 releaseType?: "draft" | "prerelease" | "release" | null;
86}
87/** @private */
88export declare function githubUrl(options: GithubOptions, defaultHost?: string): string;
89/**
90 * Generic (any HTTP(S) server) options.
91 * In all publish options [File Macros](/file-patterns#file-macros) are supported.
92 */
93export interface GenericServerOptions extends PublishConfiguration {
94 /**
95 * The provider. Must be `generic`.
96 */
97 readonly provider: "generic";
98 /**
99 * The base url. e.g. `https://bucket_name.s3.amazonaws.com`.
100 */
101 readonly url: string;
102 /**
103 * The channel.
104 * @default latest
105 */
106 readonly channel?: string | null;
107 /**
108 * Whether to use multiple range requests for differential update. Defaults to `true` if `url` doesn't contain `s3.amazonaws.com`.
109 */
110 readonly useMultipleRangeRequest?: boolean;
111}
112export interface BaseS3Options extends PublishConfiguration {
113 /**
114 * The update channel.
115 * @default latest
116 */
117 channel?: string | null;
118 /**
119 * The directory path.
120 * @default /
121 */
122 readonly path?: string | null;
123 /**
124 * The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822).
125 *
126 * @default public-read
127 */
128 readonly acl?: "private" | "public-read" | null;
129}
130export interface S3Options extends BaseS3Options {
131 /**
132 * The provider. Must be `s3`.
133 */
134 readonly provider: "s3";
135 /**
136 * The bucket name.
137 */
138 readonly bucket: string;
139 /**
140 * The region. Is determined and set automatically when publishing.
141 */
142 region?: string | null;
143 /**
144 * The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822).
145 *
146 * Please see [required permissions for the S3 provider](https://github.com/electron-userland/electron-builder/issues/1618#issuecomment-314679128).
147 *
148 * @default public-read
149 */
150 readonly acl?: "private" | "public-read" | null;
151 /**
152 * The type of storage to use for the object.
153 * @default STANDARD
154 */
155 readonly storageClass?: "STANDARD" | "REDUCED_REDUNDANCY" | "STANDARD_IA" | null;
156 /**
157 * Server-side encryption algorithm to use for the object.
158 */
159 readonly encryption?: "AES256" | "aws:kms" | null;
160 /**
161 * The endpoint URI to send requests to. The default endpoint is built from the configured region.
162 * The endpoint should be a string like `https://{service}.{region}.amazonaws.com`.
163 */
164 readonly endpoint?: string | null;
165}
166/**
167 * [DigitalOcean Spaces](https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-spaces) options.
168 * Access key is required, define `DO_KEY_ID` and `DO_SECRET_KEY` environment variables.
169 */
170export interface SpacesOptions extends BaseS3Options {
171 /**
172 * The provider. Must be `spaces`.
173 */
174 readonly provider: "spaces";
175 /**
176 * The space name.
177 */
178 readonly name: string;
179 /**
180 * The region (e.g. `nyc3`).
181 */
182 readonly region: string;
183}
184export declare function getS3LikeProviderBaseUrl(configuration: PublishConfiguration): string;
185/**
186 * [Bintray](https://bintray.com/) options. Requires an API key. An API key can be obtained from the user [profile](https://bintray.com/profile/edit) page ("Edit Your Profile" -> API Key).
187 * Define `BT_TOKEN` environment variable.
188 */
189export interface BintrayOptions extends PublishConfiguration {
190 /**
191 * The provider. Must be `bintray`.
192 */
193 readonly provider: "bintray";
194 /**
195 * The Bintray package name.
196 */
197 readonly package?: string | null;
198 /**
199 * The Bintray repository name.
200 * @default generic
201 */
202 readonly repo?: string | null;
203 /**
204 * The owner.
205 */
206 readonly owner?: string | null;
207 /**
208 * The Bintray component (Debian only).
209 */
210 readonly component?: string | null;
211 /**
212 * The Bintray distribution (Debian only).
213 * @default stable
214 */
215 readonly distribution?: string | null;
216 /**
217 * The Bintray user account. Used in cases where the owner is an organization.
218 */
219 readonly user?: string | null;
220 readonly token?: string | null;
221}