Electron Forge Publisher OSS that publish your distributable Electron app artifacts to Aliyun Object Storage Service (OSS).
Electron Forge Publisher OSS that publish your distributable Electron app artifacts to Aliyun Object Storage Service (OSS).
English | 简体中文
npm install electron-forge-publisher-oss --save
yarn add electron-forge-publisher-oss
// forge.config.js
module.exports = {
// ...
publishers: [
{
name: 'electron-forge-publisher-oss',
config: {
basePath: '/desktop',
region: 'oss-cn-hangzhou',
bucket: 'my-bucket',
accessKeyId: 'xxx',
accessKeySecret: 'xxx',
}
}
]
}
The basePath
is the base path, and other parameters are the same as the OSS parameters.
// main.js
import { autoUpdater } from 'electron'
import fetch from 'node-fetch'
const baseUrl = `https://my-bucket.oss-cn-zhangjiakou.aliyuncs.com/desktop/${platform}`
const release = await fetch(`${baseUrl}/release.json`)
const { currentRelease } = release
let url
if (process.platform === 'darwin') {
url = `${baseUrl}/release.json`
} else {
url = `${baseUrl}/${currentRelease}`
}
autoUpdater.setFeedURL({
url,
serverType: 'json'
})
autoUpdater.checkForUpdates()
2022-11-07