publishOptions.d.ts 6.9 KB

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