Electron-builder: Publishing with gitHubPublisher to an existing release always results in, the publisher thinking the release is more than 2 hours old

Created on 13 Sep 2017  路  3Comments  路  Source: electron-userland/electron-builder


  • Version:: v19.28.4:
  • Node: v6.11.0
  • NPM: 5.3.0

  • Target: windows
    (but I don't think it matters which target)
    Not sure if it matters, but I'm running/building on macOS.


Publishing to an existing release always results in Release with tag vX.X.X published at Tue Sep 12 2017 13:45:30 GMT-0500 (CDT), more than 2 hours ago

Note that this was encountered after fixing Issue #2072.

Looking at the code:

const publishedAt = release.published_at == null ? null : new Date(release.published_at)
if (publishedAt != null && (Date.now() - publishedAt.getMilliseconds()) > (2 * 3600 * 1000)) {
  // https://github.com/electron-userland/electron-builder/issues/1183#issuecomment-275867187
  warn(`Release with tag ${this.tag} published at ${publishedAt.toString()}, more than 2 hours ago`)
  return null
}

it appears that problem is caused because we are trying to get the milliseconds from the last published date/time (publishedAt.getMilliseconds()) but this results in the milliseconds for the given date/time (a 3 digit number), whereas Date.now() results in a the number of milliseconds since January 1, 1970, 00:00:00 (e.g. 1505315340692). Obviously, 1505315340692 - 253 > (2 * 3600 * 1000) will always be true.

I think the correct logic should be to convert the published_at date to a number from the get go (+new Date(release.published_at)) and not use the getMilliseconds method at all (I think the person that added that thought is was going to give the number of milliseconds since January 1, 1970, 00:00:00 and not just the milliseconds of the given time).

const publishedAt = release.published_at == null ? null : +new Date(release.published_at);
if (publishedAt != null && (Date.now() - publishedAt) > (2 * 3600 * 1000)) {
    // https://github.com/electron-userland/electron-builder/issues/1183#issuecomment-275867187
    (0, (_builderUtil || _load_builderUtil()).warn)(`Release with tag ${_this.tag} published at ${new Date(publishedAt).toString()}, more than 2 hours ago`);
    return null;
}
bug deployment

Most helpful comment

That's silly. Turns out that if I have an elecron application which I currently only release for windows, and tomorrow I publish it for Mac, I cannot add the Mac binaries to the current GitHub release because the release is older that 2 hours. And I am forced to publish a new version for windows despite not having any changes. That should not be necessary. There should be a way to bypass this time limitation with a parameter.

All 3 comments

@develar Due to the current travis CI issue with MacOS builds (macOS builds are running at reduced capacity https://www.traviscistatus.com/), the mac builds take as long as 3 hours to complete, and then this prevents my artifacts from being uploaded. Can the time duration for the builds be increased?

@imolorhe Better to use defaults and use draft releases.

That's silly. Turns out that if I have an elecron application which I currently only release for windows, and tomorrow I publish it for Mac, I cannot add the Mac binaries to the current GitHub release because the release is older that 2 hours. And I am forced to publish a new version for windows despite not having any changes. That should not be necessary. There should be a way to bypass this time limitation with a parameter.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JohnWeisz picture JohnWeisz  路  3Comments

leo picture leo  路  3Comments

AidanNichol picture AidanNichol  路  3Comments

popod picture popod  路  3Comments

talarari picture talarari  路  3Comments