Skip to content

Commit

Permalink
fixed Could not find suitable download url cli update error caused by…
Browse files Browse the repository at this point in the history
… release publishing before assets are generated
  • Loading branch information
pirog committed May 9, 2024
1 parent 8c6122f commit 811250f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})

### Bug Fixes

* Fixed `Could not find suitable download url` CLI update error caused by a release posted before assets are available

## v3.21.0-beta.20 - [May 9, 2024](https://github.com/lando/core/releases/tag/v3.21.0-beta.20)

### New Features
Expand Down
29 changes: 17 additions & 12 deletions lib/updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,23 @@ module.exports = class UpdateManager {
release.channel = release.prerelease ? 'edge' : 'stable';
// @NOTE: ditto
const asset = release.assets.find(asset => asset.name === release.binary);
// if no asset or url then error
if (!asset || !asset.url) throw new Error('Could not find suitable download url!');
release.download = asset.browser_download_url;
this._cli.updateAvailable = `@lando/cli@${hv}`;
this._cli.update = release;
this.debug(
`${extra} can be updated to %o on channel %o (%o > %o)`,
release.download,
this.channel,
hv,
this._cli.version,
);

// if we have the needed asset then update is available
// @NOTE: this check is required because the release can post before the cli binaries
// are avilable
if (asset?.url) {
release.download = asset.browser_download_url;
this._cli.updateAvailable = `@lando/cli@${hv}`;
this._cli.update = release;
this.debug(
`${extra} can be updated to %o on channel %o (%o > %o)`,
release.download,
this.channel,
hv,
this._cli.version,
);
}

resolve(this._cli);
}

Expand Down

0 comments on commit 811250f

Please sign in to comment.