Skip to content

Commit

Permalink
fix: publish produced "...armv7l.yml", but updater finds for "...ar…
Browse files Browse the repository at this point in the history
…m.yml"

Close #2884
  • Loading branch information
develar committed May 9, 2018
1 parent 4d223bf commit 7b5ffe6
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 12 deletions.
6 changes: 5 additions & 1 deletion docs/auto-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,21 @@ Emitted on progress.
**Extends**: <code>[EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)</code>
**Properties**
* <code id="AppUpdater-autoDownload">autoDownload</code> = `true` Boolean - Whether to automatically download an update when it is found.
* <code id="AppUpdater-autoInstallOnAppQuit">autoInstallOnAppQuit</code> = `true` Boolean - Whether to automatically install a downloaded update on app quit (if `quitAndInstall` was not called before).

Applicable only on Windows and Linux.
* <code id="AppUpdater-allowPrerelease">allowPrerelease</code> = `false` Boolean - *GitHub provider only.* Whether to allow update to pre-release versions. Defaults to `true` if application version contains prerelease components (e.g. `0.12.1-alpha.1`, here `alpha` is a prerelease component), otherwise `false`.

If `true`, downgrade will be allowed (`allowDowngrade` will be set to `true`).
* <code id="AppUpdater-fullChangelog">fullChangelog</code> = `false` Boolean - *GitHub provider only.* Get all release notes (from current version to latest), not just the latest.
* <code id="AppUpdater-allowDowngrade">allowDowngrade</code> = `false` Boolean - Whether to allow version downgrade (when a user from the beta channel wants to go back to the stable channel).
* <code id="AppUpdater-currentVersion">currentVersion</code> String - The current application version.
* <code id="AppUpdater-channel">channel</code> String - Get the update channel. Not applicable for GitHub. Doesn't return `channel` from the update configuration, only if was previously set.
* <code id="AppUpdater-requestHeaders">requestHeaders</code> [key: string]: string - The request headers.
* <code id="AppUpdater-logger">logger</code> [Logger](#Logger) - The logger. You can pass [electron-log](https://github.com/megahertz/electron-log), [winston](https://github.com/winstonjs/winston) or another logger with the following interface: `{ info(), warn(), error() }`. Set it to `null` if you would like to disable a logging feature.
* <code id="AppUpdater-signals">signals</code> = `new UpdaterSignal(this)` [UpdaterSignal](#UpdaterSignal) - For type safety you can use signals, e.g. `autoUpdater.signals.updateDownloaded(() => {})` instead of `autoUpdater.on('update-available', () => {})`
* <code id="AppUpdater-configOnDisk">configOnDisk</code> = `new Lazy<any>(() => this.loadUpdateConfig())` Lazy&lt;any&gt;
* <code id="AppUpdater-httpExecutor">httpExecutor</code> module:electron-updater/out/electronHttpExecutor.ElectronHttpExecutor
**Methods**
* [.AppUpdater](#AppUpdater) ⇐ <code>[EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)</code>
Expand All @@ -171,7 +176,6 @@ Emitted on progress.
* [`.downloadUpdate(cancellationToken)`](#module_electron-updater.AppUpdater+downloadUpdate) ⇒ <code>Promise&lt;any&gt;</code>
* [`.getFeedURL()`](#module_electron-updater.AppUpdater+getFeedURL) ⇒ <code>undefined</code> \| <code>null</code> \| <code>String</code>
* [`.setFeedURL(options)`](#module_electron-updater.AppUpdater+setFeedURL)
* [`.channel()`](#module_electron-updater.AppUpdater+channel)
* [`.quitAndInstall(isSilent, isForceRunAfter)`](#module_electron-updater.AppUpdater+quitAndInstall)
<a name="module_electron-updater.AppUpdater+checkForUpdates"></a>
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Env file `electron-builder.env` in the current dir ([example](https://github.com
* <code id="MetadataDirectories-buildResources">buildResources</code> = `build` String - The path to build resources.

Please note — build resources is not packed into the app. If you need to use some files, e.g. as tray icon, please include required files explicitly: `"files": ["**/*", "build/icon.*"]`
* <code id="MetadataDirectories-output">output</code> = `dist` String - The output directory.
* <code id="MetadataDirectories-output">output</code> = `dist` String - The output directory. [File macros](/file-patterns.md#file-macros) are supported.
* <code id="MetadataDirectories-app">app</code> String - The application directory (containing the application package.json), defaults to `app`, `www` or working directory.

---
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"app-builder-bin": "1.8.6",
"archiver": "^2.1.1",
"async-exit-hook": "^2.0.1",
"aws-sdk": "^2.234.1",
"aws-sdk": "^2.235.1",
"bluebird-lst": "^1.0.5",
"chalk": "^2.4.1",
"chromium-pickle-js": "^0.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder-lib/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export interface MetadataDirectories {
readonly buildResources?: string | null

/**
* The output directory.
* The output directory. [File macros](/file-patterns.md#file-macros) are supported.
* @default dist
*/
readonly output?: string | null
Expand Down
12 changes: 9 additions & 3 deletions packages/electron-builder-lib/src/publish/updateInfoBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import BluebirdPromise from "bluebird-lst"
import { Arch, hashFile, safeStringifyJson, serializeToYaml, log } from "builder-util"
import { Arch, hashFile, log, safeStringifyJson, serializeToYaml } from "builder-util"
import { GenericServerOptions, GithubOptions, PublishConfiguration, UpdateInfo, WindowsUpdateInfo } from "builder-util-runtime"
import { outputFile, outputJson, readFile } from "fs-extra-p"
import { Lazy } from "lazy-val"
Expand Down Expand Up @@ -57,8 +57,14 @@ function computeChannelNames(packager: PlatformPackager<any>, publishConfig: Pub

function getUpdateInfoFileName(channel: string, packager: PlatformPackager<any>, arch: Arch | null): string {
const osSuffix = packager.platform === Platform.WINDOWS ? "" : `-${packager.platform.buildConfigurationKey}`
const archSuffix = (arch != null && arch !== Arch.x64 && packager.platform === Platform.LINUX) ? `-${Arch[arch]}` : ""
return `${channel}${osSuffix}${archSuffix}.yml`
return `${channel}${osSuffix}${getArchPrefixForUpdateFile(arch, packager)}.yml`
}

function getArchPrefixForUpdateFile(arch: Arch | null, packager: PlatformPackager<any>) {
if (arch == null || arch === Arch.x64 || packager.platform !== Platform.LINUX) {
return ""
}
return arch === Arch.armv7l ? "-arm" : `-${Arch[arch]}`
}

export interface UpdateInfoFileTask {
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-publisher-s3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"dependencies": {
"fs-extra-p": "^4.6.0",
"aws-sdk": "^2.234.1",
"aws-sdk": "^2.235.1",
"mime": "^2.3.1",
"electron-publish": "~0.0.0-semantic-release",
"builder-util": "^0.0.0-semantic-release",
Expand Down
17 changes: 17 additions & 0 deletions test/out/linux/__snapshots__/linuxPackagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,23 @@ Object {
"size": "@size",
},
},
Object {
"file": "latest-linux-arm.yml",
"fileContent": Object {
"files": Array [
Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
"url": "TestApp-1.1.0-armv7l.AppImage",
},
],
"path": "TestApp-1.1.0-armv7l.AppImage",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
"version": "1.1.0",
},
},
],
}
`;
Expand Down
6 changes: 5 additions & 1 deletion test/src/linux/linuxPackagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ test.ifAll.ifNotWindows.ifNotCiMac("AppImage ia32", app({
test.ifAll.ifNotWindows.ifNotCiMac("AppImage arm, max compression", app({
targets: Platform.LINUX.createTarget("Appimage", Arch.armv7l),
config: {
publish: null,
// test update info file name
publish: {
provider: "generic",
url: "https://example.com/downloads"
},
compression: "maximum",
},
}))
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,9 @@ autogypi@^0.2.2:
commander "~2.9.0"
resolve "~1.1.7"

aws-sdk@^2.234.1:
version "2.234.1"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.234.1.tgz#bb8d3cbe4685db856e7bb056f38f14e7de1214f2"
aws-sdk@^2.235.1:
version "2.235.1"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.235.1.tgz#b895da9482bb5d90b2f54c45203b7a3c1c2b7cea"
dependencies:
buffer "4.9.1"
events "1.1.1"
Expand Down

0 comments on commit 7b5ffe6

Please sign in to comment.