Skip to content

Conversation

@Serophots
Copy link

(Duplicate of #351 in order to get git commits signed properly)

This PR will have cargo-packager automatically build a latest.json artefact which summarises all of the other artefacts to be consumed as an updater endpoint. This makes using cargo-packager through Github actions and Github releases fully automated by allowing the updater endpoint to be a statically hosted latest.json file accessible through https://github.com/org/repo/releases/latest/download/latest.json. This closes #350

Changes to Packager config

  /// When set, a summary `latest.json` build artefact will be generated which can be
  /// hosted alongside other build artefacts as an endpoint for the updater, including
  /// meta data about the version and URL's to point at each of the other build artefacts.
  ///
  /// Specifically, this URL specifies where these build artefacts are hosted. For example,
  /// a using Github Releases: `https://github.com/org/repo/releases/download/v{{version}}/{{artefact}}`
  ///
  /// Each endpoint optionally could have `{{version}}` or `{{artefact}}`
  /// which will be detected and replaced with the appropriate value
  ///
  /// - `{{version}}`: The version of the app which is being packaged
  /// - `{{artefact}}`: The file name of the particular build artefact
  ///     One URL is produced per build artefact.
  pub endpoint: Option<Url>,

Example latest.json

Here is an example of a latest.json generated by this PR. The schema is compatible with the existing Updater crate.

{
  "version": "4.0.0",
  "notes": null,
  "pub_date": "2025-07-04T14:12:24.096236Z",
  "platforms": {
    "aarch64-apple-darwin": {
      "url": "https://github.com/org/repo/org/download/v4.0.0/app_4.0.0_aarch64.dmg",
      "signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIGNhcmdvLXBhY2thZ2VyIHNlY3JldCBrZXkKUlVSRC82M0RjS29jcTNETVJGblAybzRtTmJlTUVZQjlBcXJPUzlUSHVDYWtSYlVTc3FzeUdBd0VWVDFEdXFrdnBqek9WT3ZrV01XcmtrZk1NYlVJNGpHSm5OTWFyRmJDRUFJPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzUxNjM4MzQ0CWZpbGU6VW5pRmx5XzQuMC4wX2FhcmNoNjQuZG1nCnR3aXFqZFMzOHIxbGJOcCtKK3QxMzVreEg1VUFvUE5qa1FsTUxHalMzNWd6NzNabkV3cGJGOWZNQ29aSXVmemZVamorRmppSG9Fa3RXSytUVkNvb0J3PT0K",
      "format": "dmg"
    }
  }
}

Caveats

  1. I have not implemented any of this for the NodeJS part of the updater, but I expect that should be fairly do-able
  2. When a particular packager format produces multiple build artefacts I have not included any logic to determine which build artefact the latest.json should point to, so currently those packager formats are excluded from the latest.json.
  3. This assumes the updates are hosted at a single (github) endpoint, whilst the updater has support for fetching from potentially multiple endpoints. I think this is passable because I assume Github releases already has its own redundancy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Updater export json RemoteRelease as build artefact

1 participant