-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GITBOOK-176: Additional context for GCS Publisher
- Loading branch information
1 parent
2472f85
commit 79313f8
Showing
2 changed files
with
42 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 %} |