Skip to content

Commit

Permalink
GITBOOK-176: Additional context for GCS Publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzhao authored and gitbook-bot committed Nov 17, 2023
1 parent 2472f85 commit 79313f8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 18 deletions.
2 changes: 1 addition & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
58 changes: 41 additions & 17 deletions config/publishers/gcs.md
Original file line number Diff line number Diff line change
@@ -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 %}

0 comments on commit 79313f8

Please sign in to comment.