Feature: support auto update now

This commit is contained in:
萌萌哒赫萝
2023-04-05 22:55:35 +08:00
parent ca950dbd44
commit e39cac9f3b
14 changed files with 130 additions and 7 deletions

View File

@@ -11,7 +11,13 @@ const darwin = [{
ext: '.dmg',
arch: '-x64',
'version-file': 'latest-mac.yml'
}]
}, {
appNameWithPrefix: 'PicList-',
ext: '.dmg',
arch: '-universal',
'version-file': 'latest-mac.yml'
}
]
const linux = [{
appNameWithPrefix: 'PicList-',

View File

@@ -2,12 +2,13 @@ const pkg = require('../package.json')
const version = pkg.version
// TODO: use the same name format
const generateURL = (platform, ext, prefix = 'PicList-') => {
return `https://release.piclist.cn/${version}/${prefix}${version}${platform}${ext}`
return `https://release.piclist.cn/latest/${prefix}${version}${platform}${ext}`
}
const platformExtList = [
['-arm64', '.dmg', 'PicList-'],
['-x64', '.dmg', 'PicList-'],
['-universal', '.dmg', 'PicList-'],
['', '.AppImage', 'PicList-'],
['-ia32', '.exe', 'PicList-Setup-'],
['-x64', '.exe', 'PicList-Setup-'],

View File

@@ -10,7 +10,7 @@ const path = require('path')
const BUCKET = 'piclist-dl'
const VERSION = pkg.version
const FILE_PATH = `${VERSION}/`
const FILE_PATH = `latest/`
const ACCOUNT_ID = process.env.R2_ACCOUNT_ID
const SECRET_ID = process.env.R2_SECRET_ID
const SECRET_KEY = process.env.R2_SECRET_KEY
@@ -78,6 +78,11 @@ const uploadFile = async () => {
Key: `${versionFileName}`,
Body: versionFileBuffer
}).promise()
await s3.upload({
Bucket: BUCKET,
Key: `${FILE_PATH}${versionFileName}`,
Body: versionFileBuffer
}).promise()
versionFileHasUploaded = true
}
}