如何将 AWS S3 存储桶提要 url 设置为 Electron autoUpdater
How to set a AWS S3 bucket feed url to Electron autoUpdater
我可以将电子应用程序发布到 AWS S3 存储桶。但是如何使用电子自动更新程序从电子应用程序发布的 S3 存储桶中获取更新?
默认情况下,所有文件都位于以下键:
${config.folder || appVersion}/${artifactName}
配置选项记录在PublisherS3Config
中
{
name: '@electron-forge/publisher-s3',
config: {
bucket: 'my-bucket',
public: true
}
}
对于使用 Squirrel(即使用 electron-forge)的人来说,有一些关键设置可以实现无服务器。以 DO Spaces 为例,但同样适用于任何 s3 兼容的桶存储。
锻造配置如下:
...
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {
setupExe: 'Setup.exe', // Fixed path for latest setup exe
remoteReleases: 'https://<bucket>.<region>.digitaloceanspaces.com/<folder>'
},
}
],
make_targets: {
win32: ['squirrel'],
},
publishers: [
{
name: '@electron-forge/publisher-s3',
config: {
bucket: '<bucket>',
endpoint: 'https://<region>.digitaloceanspaces.com',
folder: '<folder>', // IMPORTANT: always use the same folder
region: '<region>',
public: true // Necessary for serverless
}
}
],
...
然后我们只需将自动更新程序指向存储桶:
autoUpdater.setFeedURL('https://<bucket>.<region>.digitaloceanspaces.com/<folder>')
之所以可行,是因为 Squirrel 本身甚至可以与静态文件系统或服务器一起工作,所有逻辑都融入了 Update.exe 本身。它只是查看提要 url 中的 RELEASES 文件,并确定是否需要使用列出的 nuget 包进行更新。
本质上,变量文件夹 URL 是阻止它与 autoUpdater.setFeedUrl()
开箱即用的原因,您需要所有文件(setup.exe、RELEASES 和每个版本的 nuget)在同一文件夹中用于相同 platform/architecture.
注意:使用CDN要小心!如果 RELEASES 被缓存,那么应用程序将不会更新,直到它获得新版本。
我可以将电子应用程序发布到 AWS S3 存储桶。但是如何使用电子自动更新程序从电子应用程序发布的 S3 存储桶中获取更新?
默认情况下,所有文件都位于以下键:
${config.folder || appVersion}/${artifactName}
配置选项记录在PublisherS3Config
中{
name: '@electron-forge/publisher-s3',
config: {
bucket: 'my-bucket',
public: true
}
}
对于使用 Squirrel(即使用 electron-forge)的人来说,有一些关键设置可以实现无服务器。以 DO Spaces 为例,但同样适用于任何 s3 兼容的桶存储。
锻造配置如下:
...
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {
setupExe: 'Setup.exe', // Fixed path for latest setup exe
remoteReleases: 'https://<bucket>.<region>.digitaloceanspaces.com/<folder>'
},
}
],
make_targets: {
win32: ['squirrel'],
},
publishers: [
{
name: '@electron-forge/publisher-s3',
config: {
bucket: '<bucket>',
endpoint: 'https://<region>.digitaloceanspaces.com',
folder: '<folder>', // IMPORTANT: always use the same folder
region: '<region>',
public: true // Necessary for serverless
}
}
],
...
然后我们只需将自动更新程序指向存储桶:
autoUpdater.setFeedURL('https://<bucket>.<region>.digitaloceanspaces.com/<folder>')
之所以可行,是因为 Squirrel 本身甚至可以与静态文件系统或服务器一起工作,所有逻辑都融入了 Update.exe 本身。它只是查看提要 url 中的 RELEASES 文件,并确定是否需要使用列出的 nuget 包进行更新。
本质上,变量文件夹 URL 是阻止它与 autoUpdater.setFeedUrl()
开箱即用的原因,您需要所有文件(setup.exe、RELEASES 和每个版本的 nuget)在同一文件夹中用于相同 platform/architecture.
注意:使用CDN要小心!如果 RELEASES 被缓存,那么应用程序将不会更新,直到它获得新版本。