diff --git a/SUMMARY.md b/SUMMARY.md index 4153d5f..c3c9ed5 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -29,9 +29,9 @@ * [Bitbucket](config/publishers/bitbucket.md) * [Electron Release Server](config/publishers/electron-release-server.md) * [GitHub](config/publishers/github.md) + * [Google Cloud Storage](config/publishers/gcs.md) * [Nucleus](config/publishers/nucleus.md) * [S3](config/publishers/s3.md) - * [GCS](config/publishers/gcs.md) * [Snapcraft](config/publishers/snapcraft.md) * [Hooks](config/hooks.md) diff --git a/config/publishers/gcs.md b/config/publishers/gcs.md index 6ab847b..e293132 100644 --- a/config/publishers/gcs.md +++ b/config/publishers/gcs.md @@ -1,31 +1,55 @@ +--- +description: Publishing your Electron app artifacts to a Google Cloud Storage bucket. +--- + # Google Cloud Storage {% hint style="info" %} -This publish target was added in Electron Forge 7.1.0. +This Publisher was added in Electron Forge **v7.1.0**. {% endhint %} -The Google Cloud Storage (GCS) target publishes all your artifacts to a [Google Cloud Storage bucket](https://cloud.google.com/storage/docs), nothing fancy here, literally just puts all your artifacts straight into the bucket. +The Google Cloud Storage target publishes all your artifacts to a [Google Cloud Storage bucket](https://cloud.google.com/storage/docs). -{% hint style="warning" %} -If you run publish twice with the same version on the same platform it is possible for your old artifacts to get overwritten in Storage. It is your responsibility to ensure that you don't overwrite your own releases. -{% endhint %} +## Authentication -By default all files are positioned at the following key: +Under the hood, the Google Cloud Storage Publisher uses the `@google-cloud/storage` SDK and its associated authentication options. -`${config.folder || version}/${artifactName}` +We recommend following [Google's authentication documentation for client libraries](https://cloud.google.com/docs/authentication/client-libraries#node.js) to get authentication configured. -Configuration options are documented in [`PublisherGCSConfig`](https://js.electronforge.io/publisher/gcs/interfaces/publishergcsconfig.html) +## Usage -### Usage +To pass options into the Google Cloud Storage SDK's [Storage constructor](https://cloud.google.com/nodejs/docs/reference/storage/latest/storage/storageoptions), use the `config.storageOptions` parameter. +{% code title="forge.config.js" %} ```javascript -{ - name: '@electron-forge/publisher-gcs', - config: { - bucket: 'my-bucket', - public: true - } -} +module.exports = { + // ... + publishers: [ + { + name: '@electron-forge/publisher-gcs', + config: { + storageOptions: { + // add additional Storage constructor parameters here + projectId: "my-project-id", + }, + bucket: 'my-bucket', + folder: 'custom-folder-name', + public: true, + } + } + ] +}; +``` +{% endcode %} + +When executed, the Publisher will publish to your GCS bucket under the following key: + +``` +${config.folder || version}/${artifactName} ``` -It is recommended to authenticate by providing path to JSON file that contains your Google service account credentials by environment variable `GOOGLE_APPLICATION_CREDENTIALS`. +Additional configuration options are documented in [`PublisherGCSConfig`](http://js.electronforge.io/interfaces/\_electron\_forge\_publisher\_gcs.PublisherGCSConfig.html). + +{% hint style="warning" %} +If you run publish twice with the same version on the same platform, it is possible for your old artifacts to get overwritten in Storage. It is your responsibility to ensure that you don't overwrite your own releases. +{% endhint %}