OrchardCMS / OrchardCore.Commerce

The commerce module for Orchard Core.
MIT License
219 stars 90 forks source link

Build NuGet and CloudSmith Packages (OCC-29) #42

Closed agriffard closed 2 years ago

agriffard commented 5 years ago

Will you create a dev branch at some point?

Then, is it possible to setup a CI (Travis, AppVeyor) in order to build the packages?

It would be great if devpackages could be uploaded to a MyGet feed and master to NuGet, as it is done in OC.

bleroy commented 5 years ago

Sure is possible.

bleroy commented 4 years ago

I'd add to this configuring GitHub actions to build, package and test, rather than an external CI, if that's sufficient for our needs.

barthamark commented 2 years ago

I believe this is complete. Is there anything else missing from here @bleroy @agriffard ?

bleroy commented 2 years ago

As far as I can tell, the CI workflow doesn't upload packages to MyGet and NuGet as requested by @agriffard .

Skrypt commented 2 years ago

Should we push to the same Cloudsmith account as Orchard Core or we should ask you Bertrand to create a separate account for MyGet, Nuget, and CloudSmith?

I got stuck while reorganizing the projects a while ago because the project is built as a single shared assembly while I think some projects could/should be abstractions and used as Nuget packages.

bleroy commented 2 years ago

I'm puzzled: the project is not built as a single assembly.

Also, since I'm no longer the main maintainer of the project, it wouldn't make sense for me to open the accounts. The project is under the Orchard GitHub org, it seems like we should do the same thing and use the same accounts as the main project.

Skrypt commented 2 years ago

You are right It is not a single assembly. We need to ask @sebastienros what he thinks about it.

Skrypt commented 2 years ago

Here is my confusion.

image

I created an OrchardCore.Commerce.Targets module so that I can reference it simply from my main web project. This way, it becomes a single required referenced assembly. Though, I did this to replicate also the Orchard Core project folder structure so that I can reuse the same Github workflows and VS Code launcher/tasks.

sarahelsaig commented 2 years ago

This can utilize our reusable GitHub workflow for publishing to a NuGet feed. I don't think it's necessary to have a separate dev branch, pushing to main could trigger a publish for CloudSmith/MyGet and creating a release could trigger a publish for NuGet. That would be cleaner and I think we have all the pieces to make it happen.

@sebastienros what do you think, should it be under the Orchard Core CloudSmith account as Jasmin suggested?

Piedone commented 2 years ago

We can publish preview packages, i.e. packages after all main commits to Cloudsmith, under the OrchardCore account, and release packages to NuGet, under the Orchard account. I.e. the same as we do with OC.

sarahelsaig commented 2 years ago

@sebastienros could you please update the two secrets here? (CLOUDSMITH_API_KEY and NUGET_API_KEY; I have added the variables with only placeholder values.) Then we can start with this issue asap. Thanks.

Piedone commented 2 years ago

Before the first NuGet release, we should decide on the names of AddressDataType and MoneyDataType. I recommend just prefixing them with OrchardCore.Commerce..

sarahelsaig commented 2 years ago

I agree. Even if they are meant to be generic, they will evolve alongside OCC so they should be together. Anyone against this namespace change, please chime in.

sarahelsaig commented 2 years ago

@sebastienros could you please update the two secrets here? (CLOUDSMITH_API_KEY and NUGET_API_KEY; I have added the variables with only placeholder values.) Then we can start with this issue asap. Thanks.

up

Piedone commented 2 years ago

Hmm, the (or some) keys are there, actually!

image

So Sebastien swooped in but forgot to tell?

(Before you ask, I have access to this settings page but not to the NuGet account, hence why I didn't do it in the first place.)

Piedone commented 2 years ago

Ah no, now I notice that Dávid you added placeholders.

sarahelsaig commented 2 years ago

Yup, these are just the empty variables I've set up, waiting for the values to be updated. (you can see that the "days ago" is the same as my previous comment)

Piedone commented 2 years ago

I remembered I actually have access to the Cloudsmith repo! So created and configured one: https://cloudsmith.io/~orchardcore/repos/commerce/packages/

However, to provide push access to it, a user's API key is needed. You can only use a user's single, personal API key to publish packages. The recommended way to do this is by creating a bot account just for this. I'd do that, but I need to store the credentials somewhere. Isn't there an Orchard LastPass, @sebastienros?

sarahelsaig commented 2 years ago

The preview repo seems to be using Sébastien's personal account so a technical user probably wasn't considered. image Can't we create a dedicated account using a Lombiq email address, at least for now? You wouldn't have to store the creds, since it won't be used for anything else. Then Sébastien & co can replace it with something else later if they want to.

sarahelsaig commented 2 years ago

btw I've already made the namespace changes and created the workflows in a branch. Didn't have the opportunity to test them in lieu of the API keys, but the NuGet workflow should be perfect as it's exactly the same we use to publish Lombiq's open source projects. The CloudSmith workflow required a non-trivial improvement in the parent action, because that would trigger on every main merge instead of a tag, but I'm optimistic and eager to test it.

Piedone commented 2 years ago

I've added Lombiq Bot to the Bots group (https://cloudsmith.io/orgs/orchardcore/teams/bots/members/) and configured the API key under Secrets.

sarahelsaig commented 2 years ago

Thanks. It works for CloudSmith now.

However for now I could only test it by pushing a tag. (Looks like on.publish.branches = ["main"] condition can only be triggered from the main branch? If so, that's perfectly logical. OC is doing the same anyway so it should be fine)

I'm still waiting for a NuGet key, then this can be reviewed.

Piedone commented 2 years ago

Yep, the branch trigger will only work if the workflow exists on that branch.

sebastienros commented 2 years ago

NUGET_API_KEY updated with same key as in OC

sarahelsaig commented 2 years ago

Thanks Sébastien, it works. https://www.nuget.org/packages/OrchardCore.Commerce