electron-builder AliYun OSS bucket publisher
Base beyond @FNCxPro's electron-publisher-gcs
Install electron-publisher-alioss
npm i -D electron-publisher-alioss
OR
yarn add -D electron-publisher-alioss
Cause we can now only to pass the configuration to the publisher by using the "custom" provider(ISSUE#3261: Allow pass configuration to custom electron-publisher provider), so we need to create a electron-publisher-custom.js under the build-resource-folder(it should be build/ as default) , and export the alioss-publisher by ourself.
// build/electron-publisher-custom.js
const Publisher = require('electron-publisher-alioss')
module.exports = Publisher;
Next, set your publish providers as below
//package.json
{
"name": "your-app-name",
"build": {
"appId": "your.appId",
"compression": "normal",
"productName": "your App",
"win": {
"target": "nsis"
},
"publish": [
{
"provider": "generic",
"url": "https:///${name}/${os}/${arch}/"
},
{
"provider": "custom",
"providerName": "alioss",
"path": "/${name}/${os}/${arch}/${filename}",
"bucket": "test",
"region": "oss-region",
"accessKeyId": "your-ali-oss-accesskeyid",
"accessKeySecret": "your-ali-oss-accesskeysecrect",
"resumable": true
}
]
}
}
if you want to save your ali-oss bucket info in anther file, you can use localConfig
//package.json
{
"name": "your-app-name",
"build": {
"appId": "your.appId",
"compression": "normal",
"productName": "your App",
"win": {
"target": "nsis"
},
"publish": [
{
"provider": "generic",
"url": "https:///${name}/${os}/${arch}/"
},
{
"provider": "custom",
"providerName": "alioss",
"localConfig": "~/some/where/u/want/ali-oss-config.json"
}
]
}
}
// ~/some/where/u/want/ali-oss-config.json
{
"path": "/${name}/${os}/${arch}/${filename}",
"bucket": "test",
"region": "oss-region",
"accessKeyId": "your-ali-oss-accesskeyid",
"accessKeySecret": "your-ali-oss-accesskeysecrect",
"resumable": true
}
Basic setting is done.Enjoy the publish then.
Type: string
Default: /${name}/${os}/${arch}/${filename}
name
: the app's name (from electron-builder)os
:task.packager.platform.name
arch
: Architecturefilename
: The filename of the file being uploaded
Example:
/${name}/${os}/${arch}/${filename}
Type: boolean
Default: true
Type: number
default: 5
Type: boolean
Default: false