atlassian / nucleus

A configurable and versatile update server for all your Electron apps
Other
393 stars 91 forks source link

Can't release both Mac and Windows zip files #123

Open smee30 opened 3 years ago

smee30 commented 3 years ago

When publishing a release that contains zip files for more than one platform, only one of them will be published. The first set to be released wins: so if I release the Windows version first, then when I come to release the Mac version there is already a release zip file and no Mac zip file will be released. This means upgrades now fail on Mac.

The issue seems to be that this method in BaseDriver.ts:

  /**
   * This method compares to file names to determine if they are technically the same
   * file in the context of a single version/platform/arch combination.  This is used
   * to ensure we never upload two -full.nupkg files to a single version, or two .dmg
   * files.
   * 
   * @param file1 The name of the first file
   * @param file2 The name of the second file
   */
  protected isInherentlySameFile(file1: string, file2: string) {
    for (const suffix of IDENTIFYING_SUFFIXES) {
      if (file1.endsWith(suffix) && file2.endsWith(suffix)) {
        return true;
      }
    }
    return false;
  }

This falsely concludes that just because both are zip files, they are 'inherently the same file' leading the first one to win and the second one to be discarded. It should check additional parts of the filename to match platform strings.

Workaround: Always release the Mac files first.

seanmacisaac commented 2 years ago

Pretty sure https://github.com/WonderInventions/nucleus/commit/defd2772a2da5a9ecf5b9ed680730682418ad3e5 is the correct fix for this. As long as the files are for different platforms or architectures it doesn't matter if the names are the same. And in fact the comment even says it should be used in this way.

I ran into this because I am trying to publish both arm64 and x86 versions of our app for Mac. I also had to make this commit https://github.com/WonderInventions/nucleus/commit/f96ed48b454bd1c7532030f88e1efc8140273d24 to get nucleus to support arm64 for Mac.

If this ever starts getting maintenance love I'm happy to make PRs.