electron-archive / grunt-electron-installer

Grunt plugin to build Windows installers for Electron apps
MIT License
402 stars 106 forks source link

Issue with prereleases coming from nuget.semanticversion #85

Open maxkorp opened 8 years ago

maxkorp commented 8 years ago

So we're trying to build prerelease versions with names like 3.2.1-RC4, but nuget semver is throwing weird errors where it strips out most of the version number.

Running "create-windows-installer:latest" (create-windows-installer) task
>> System.ArgumentException: '4' is not a valid version string.
>> Parameter name: version
>>    at NuGet.SemanticVersion.Parse(String version)
>>    at Squirrel.VersionExtensions.ToSemanticVersion(String fileName)
>>    at Squirrel.ReleaseEntry.<WriteReleaseFile>b__6(ReleaseEntry x)
>>    at System.Linq.EnumerableSorter`2.ComputeKeys(TElement[] elements, Int32 count)
>>    at System.Linq.EnumerableSorter`1.Sort(TElement[] elements, Int32 count)
>>    at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext()
>>    at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
>>    at System.String.Join(String separator, IEnumerable`1 values)
>>    at Squirrel.ReleaseEntry.WriteReleaseFile(IEnumerable`1 releaseEntries, Stream stream)
>>    at Squirrel.ReleaseEntry.WriteReleaseFile(IEnumerable`1 releaseEntries, String path)
>>    at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi)
>>    at Squirrel.Update.Program.executeCommandLine(String[] args)
>>    at Squirrel.Update.Program.main(String[] args)
>>    at Squirrel.Update.Program.Main(String[] args)
Warning: Command failed: C:\projects\GitKraken\build\node_modules\grunt-electron-installer\vendor\Update.com --releasify C:\Users\appveyor\AppData\Local\Temp\1\si1151024-2184-1gv97u2\gitkraken.3.2.1-RC4.nupkg --releaseDir C:
\projects\GitKraken\dist --loadingGif C:\projects\GitKraken\resources\win\installerImage.gif --signWithParams /a /f "C:\projects\GitKraken\vendor\windows_codesigning_cert.pfx" /p "asdf"
System.ArgumentException: '4' is not a valid version string.
Parameter name: version
   at NuGet.SemanticVersion.Parse(String version)
   at Squirrel.VersionExtensions.ToSemanticVersion(String fileName)
   at Squirrel.ReleaseEntry.<WriteReleaseFile>b__6(ReleaseEntry x)
   at System.Linq.EnumerableSorter`2.ComputeKeys(TElement[] elements, Int32 count)
   at System.Linq.EnumerableSorter`1.Sort(TElement[] elements, Int32 count)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.String.Join(String separator, IEnumerable`1 values)
   at Squirrel.ReleaseEntry.WriteReleaseFile(IEnumerable`1 releaseEntries, Stream stream)
   at Squirrel.ReleaseEntry.WriteReleaseFile(IEnumerable`1 releaseEntries, String path)
   at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi)
   at Squirrel.Update.Program.executeCommandLine(String[] args)
   at Squirrel.Update.Program.main(String[] args)
   at Squirrel.Update.Program.Main(String[] args)
Use --force to continue.

Aborted due to warnings.

Now, in nuget's semver specs it says soemthing like 3.2.1-RC.4 is not allowed, but something without the period in the component after the - is. This module is even splitting on that -, and removing all of the periods in the tailing component of the version to match that. It appears however that they're somehow stripping down everything before the -, and then their semver parse is stripping off the text before numbers. Is this a known issue (with nuget, squirrel, grunt-electron-installer, or commonly in end-user code)?

anaisbetts commented 8 years ago

This feature was only very recently added, are you using the latest version of erry'thing?

maxkorp commented 8 years ago

grunt-electron-installer at 1.1.0, yeah.

maxkorp commented 8 years ago

So, at what point were prereleases added to nuget? It looks like the nuget in squirrel.windows hasn't really been tied to the core since may? (Forked by Haacked then, and paul has 3 new commits since then locally).

Edit: For the time being, I was able to replace the version I passed to the grunt config for the task with one replacing -RC with 000, so 3.2.1-RC4 becomes 3.2.10004. Since we keep our prereleases in a separate folder entirely, thats enough to get it working short term. Still not ideal, but it works.

anaisbetts commented 8 years ago

Prereleases in NuGet have been there forever, but we recently enabled them in Squirrel.Windows (previously Squirrel used the prerelease tag for its own purposes). Atom is using the -betaN tag and we've done it as well, it's surprising that -RC doesn't work. Can you try with -beta just for funsies?

maxkorp commented 8 years ago

Sure thang :+1:

maxkorp commented 8 years ago

That worked O.o

anaisbetts commented 8 years ago

I think the word beta has special meaning to NuGet :-/

maxkorp commented 8 years ago

Well, their docs specify that pretty much whatever should be ok there. I'll play with it more, see if maybe capitalization has a role? All of their examples are lower case, now that I think of it.

DanSantimore commented 8 years ago

For what it's worth, I think the semanticversion.parse() regex in the nuget version being used by squirrel must be wrong, because it seems to fail whenever I use upper case. E.g., 1.0.0-QA41 fails, but 1.0.0-qa41 succeeds.