diff --git a/packages/gui/.env b/packages/gui/.env index 20acbd7..ba94875 100644 --- a/packages/gui/.env +++ b/packages/gui/.env @@ -1 +1,2 @@ VUE_APP_PUBLISH_URL=http://dev-sidecar.docmirror.cn/update/ +VUE_APP_PUBLISH_PROVIDER=generic \ No newline at end of file diff --git a/packages/gui/pkg/after-all-artifact-build.js b/packages/gui/pkg/after-all-artifact-build.js index 51ad904..0e8b3cf 100644 --- a/packages/gui/pkg/after-all-artifact-build.js +++ b/packages/gui/pkg/after-all-artifact-build.js @@ -15,6 +15,7 @@ function appendIntro (context, systemType, latest) { }) } exports.default = async function (context) { + console.log('after-all-artifact-build', context) appendIntro(context, 'mac', 'latest-mac.yml') appendIntro(context, 'win', 'latest.yml') appendIntro(context, 'linux', 'latest-linux.yml') diff --git a/packages/gui/pkg/after-pack-content.js b/packages/gui/pkg/after-pack-content.js deleted file mode 100644 index c1b6d53..0000000 --- a/packages/gui/pkg/after-pack-content.js +++ /dev/null @@ -1,7 +0,0 @@ -const fs = require('fs') -exports.default = async function (context) { - // console.log('context', context) - if (context.packager.platform.nodeName === 'linux') { - fs.copyFileSync('../build/app-update.yml', '../dist_electron/linux_unpacked/resources/app-update.yml') - } -} diff --git a/packages/gui/pkg/after-pack.js b/packages/gui/pkg/after-pack.js index c5b43a5..d312c9c 100644 --- a/packages/gui/pkg/after-pack.js +++ b/packages/gui/pkg/after-pack.js @@ -1,6 +1,22 @@ const path = require('path') const AdmZip = require('adm-zip') const pkg = require('../package.json') +const fs = require('fs') + +function writeAppUpdateYmlForLinux () { + const publishUrl = process.env.VUE_APP_PUBLISH_URL + const publishProvider = process.env.VUE_APP_PUBLISH_PROVIDER + // provider: generic + // url: 'http://dev-sidecar.docmirror.cn/update/preview/' + // updaterCacheDirName: '@docmirrordev-sidecar-gui-updater' + const fileContent = `provider: ${publishProvider} +url: '${publishUrl}' +updaterCacheDirName: '@docmirrordev-sidecar-gui-updater' +` + console.log('write linux app-update.yml,updateUrl:', publishUrl) + const filePath = path.resolve('./dist_electron/linux-unpacked/resources/app-update.yml') + fs.writeFileSync(filePath, fileContent) +} exports.default = async function (context) { // console.log('context', context) let targetPath @@ -11,6 +27,7 @@ exports.default = async function (context) { } else if (context.packager.platform.nodeName === 'linux') { targetPath = path.join(context.appOutDir, './resources') systemType = 'linux' + writeAppUpdateYmlForLinux() } else { targetPath = path.join(context.appOutDir, './resources') systemType = 'win' diff --git a/packages/gui/vue.config.js b/packages/gui/vue.config.js index c7e0765..7f3b73a 100644 --- a/packages/gui/vue.config.js +++ b/packages/gui/vue.config.js @@ -1,6 +1,7 @@ const path = require('path') const webpack = require('webpack') const publishUrl = process.env.VUE_APP_PUBLISH_URL +const publishProvider = process.env.VUE_APP_PUBLISH_PROVIDER console.log('publish url', publishUrl) module.exports = { pages: { @@ -38,7 +39,7 @@ module.exports = { builderOptions: { afterPack: './pkg/after-pack.js', afterAllArtifactBuild: './pkg/after-all-artifact-build.js', - afterPackContent: './pkg/after-pack-content.js', + // artifactBuildCompleted: './pkg/artifact-build-completed.js', // builderOptions: { // publish: ['github']// 此处写入github 就好,不用添加其他内容 // }, @@ -68,12 +69,12 @@ module.exports = { linux: { icon: 'build/mac/', target: [ - 'deb', + // 'deb', 'AppImage' ] }, publish: { - provider: 'generic', + provider: publishProvider, url: publishUrl // url: 'http://dev-sidecar.docmirror.cn/update/preview/' }