adams85 / acornima

Acornima is a standard-compliant JavaScript parser for .NET. It is a fork of Esprima.NET combined with the .NET port of the acornjs parser.
BSD 3-Clause "New" or "Revised" License
9 stars 3 forks source link

Add NuGet/Feedz.io publish support #4

Closed lahma closed 4 months ago

lahma commented 4 months ago
adams85 commented 4 months ago

The end of happy direct pushing to master, huh? :D

Looks awesome BTW! Just a few questions:

  1. Will this publish both the Acornima and Acornima.Extras packages? (I decided to extract the non-essential parts into a separate package to keep the core package as light as possible.)
  2. While we're at it, could you maybe enable source link and determistic build as well before we start to release packages? (The latter can be tricky though. In principle, you need to set the ContinuousIntegrationBuild MSBuild property and that's it. However, as far as I can remember, it does matter at what stage it is passed to MSBuild. For example, if there's a dotnet build, then later a dotnet pack, it won't work if you pass it to dotnet pack because that won't trigger a rebuild. In another project, I ended up with something like this).
adams85 commented 4 months ago

Oh, and one more:

if not tagged build publish to feedz.io (needs registration by you first)

I can see here that you created some workspace for acornima at feedz.io. I registered with my GH account. But how can I manage the secrets of this workspace?

lahma commented 4 months ago

I think it will be easier to refer to the current build log here, I'm also sanity checking my answers...

https://github.com/adams85/acornima/actions/runs/7940588505/job/21682044595?pr=4

  1. Will this publish both the Acornima and Acornima.Extras packages? (I decided to extract the non-essential parts into a separate package to keep the core package as light as possible.)

Seems both Extras and SourceGenerators are packed, so they will be also published. Maybe source generators should have <IsPackable>false</IsPackable>? This can be fine tuned later too as not publishing to NuGet yet.

> Pack
  08:54:02 [INF] > /usr/bin/dotnet pack /home/runner/work/acornima/acornima/Acornima.sln --configuration Release --no-build --output /home/runner/work/acornima/acornima/artifacts/packages --version-suffix preview-20240217-0852
  08:54:03 [DBG] MSBuild version 17.8.3+195e7f5a3 for .NET
  08:54:04 [DBG]   The package Acornima.SourceGenerators.0.1.0-preview-20240217-0852 is missing a readme. Go to https://aka.ms/nuget/authoring-best-practices/readme to learn why package readmes are important.
  08:54:04 [DBG]   Successfully created package '/home/runner/work/acornima/acornima/artifacts/packages/Acornima.SourceGenerators.0.1.0-preview-20240217-0852.nupkg'.
  08:54:04 [DBG]   The package Acornima.Extras.0.1.0-preview-20240217-0852 is missing a readme. Go to https://aka.ms/nuget/authoring-best-practices/readme to learn why package readmes are important.
  08:54:04 [DBG]   Successfully created package '/home/runner/work/acornima/acornima/artifacts/packages/Acornima.Extras.0.1.0-preview-20240217-0852.nupkg'.
  08:54:04 [DBG]   The package Acornima.0.1.0-preview-20240217-0852 is missing a readme. Go to https://aka.ms/nuget/authoring-best-practices/readme to learn why package readmes are important.
  08:54:04 [DBG]   Successfully created package '/home/runner/work/acornima/acornima/artifacts/packages/Acornima.0.1.0-preview-20240217-0852.nupkg'.
  1. While we're at it, could you maybe enable source link and determistic build as well before we start to release packages? (The latter can be tricky though. In principle, you need to set the ContinuousIntegrationBuild MSBuild property and that's it. However, as far as I can remember, it does matter at what stage it is passed to MSBuild. For example, if there's a dotnet build, then later a dotnet pack, it won't work if you pass it to dotnet pack because that won't trigger a rebuild. In another project, I ended up with something like this).

Well this is the cool thing about NUKE, it has all these smarts built in when we use ICompile interfaces defaults interface methods...

https://github.com/nuke-build/nuke/blob/59bdf80fcbe9b11f9e443a701d455b5aaa58c532/source/Nuke.Components/ICompile.cs#L45-L51

As we can see in build log:

> Compile
  08:52:17 [INF] > /usr/bin/dotnet build /home/runner/work/acornima/acornima/Acornima.sln --configuration Release --no-restore --version-suffix preview-20240217-0852 /property:ContinuousIntegrationBuild=True

I can see here that you created some workspace for acornima at feedz.io. I registered with my GH account. But how can I manage the secrets of this workspace?

I haven't setup nothing yet, I'm hoping that you will register (and can also update the final feed URL into this PR if not what I suspected).

This is is what I have registered for Quartz.NET

image

And I have this kind of configuration on GitHub side (note that I have slightly different setup and different feedz API key):

image

The build for this repo expects to have these configured in this repo's secrets: FEEDZ_NUGET_API_KEY and PUBLIC_NUGET_API_KEY . Why feedz? MyGet seems to be quite badly handled and was down for many days without company giving any statement, some lost their packages too AFAIK. Doesn't matter too much as preview but.. anyway.

lahma commented 4 months ago

I'll push a tweak to ensure source packages are part of packaging too..

lahma commented 4 months ago

Pushed some tweaks to improve package metadata, excluding source generator project from packaging and now also snupkg should be generated, adding Microsoft.SourceLink.GitHub package reference to get Git repo and commit info as part of package.

The time to get some shuteye at this point, happy to answer more questions as they rise.

adams85 commented 4 months ago

Well this is the cool thing about NUKE, it has all these smarts built in when we use ICompile interfaces defaults interface methods...

Wow, I like NUKE more and more! Will need to spend some time though to get familiar with it. I'd have hardly figured it out that it uses DIMs to provide defaults... :D

I haven't setup nothing yet, I'm hoping that you will register (and can also update the final feed URL into this PR if not what I suspected).

Interestingly, https://f.feedz.io/acornima/acornima/nuget/index.json returned 200 OK with some valid-looking content. Got confused because of that.

Anyway, I created an org named "acornima" and a repo named the same, so the URL you set in the PR should be actually valid now. Also added the FEEDZ_NUGET_API_KEY secret on GH.

MyGet seems to be quite badly handled and was down for many days without company giving any statement, some lost their packages too AFAIK. Doesn't matter too much as preview but.. anyway.

Yeah, I haven't had a very good experience with MyGet either. For now, I'm totally happy with feedz, then we'll see how it pans out.

I'll push a tweak to ensure source packages are part of packaging too..

Pushed some tweaks to improve package metadata, excluding source generator project from packaging and now also snupkg should be generated, adding Microsoft.SourceLink.GitHub package reference to get Git repo and commit info as part of package.

Big thanks! 🙏 I'll take a closer look tomorrow, but I think we're all set now.

adams85 commented 4 months ago

The first preview releases started to appear on feedz.io! 🚀

I checked, both source link and deterministic build work just fine. Many thanks again! 🥇