ecosystem icon indicating copy to clipboard operation
ecosystem copied to clipboard

Workflow for prepping to publish multiple independent packages in one commit

Open jakemac53 opened this issue 2 years ago • 4 comments

In the test repo we have 3 packages, test -> test_core -> test_api. Where a dependency exists between them they pin exact versions. We typically use the pubspec_overrides.yaml file to override the deps so that version solves work

It looks like pub lish --dry-run does not use the pubspec_overrides.yaml overrides though, so the validation step fails when we go to publish the versions (with a bad version solve).

jakemac53 avatar Feb 15 '23 18:02 jakemac53

example failure is here https://github.com/dart-lang/test/actions/runs/4177742557/jobs/7235693797

jakemac53 avatar Feb 15 '23 18:02 jakemac53

Great, thanks for the info. I imagine - due to the dependencies above - that you publish them in the reverse order? So, test_api, then test_core, then test?

devoncarew avatar Feb 15 '23 18:02 devoncarew

Correct, so we can get a valid version solve prior to publishing each (for non-dev deps at least). So the actual publish workflow should work fine, its just the validation step that validates all of them prior to any being published that fails.

jakemac53 avatar Feb 15 '23 18:02 jakemac53

One way I can imagine handling this is to parse the errors and understand when an error is specifically for a missing package which is also one that is marked as publishable in the same action.

I'm not sure if that way would be brittle, but it wouldn't give the full safety that a pub feature like https://github.com/dart-lang/pub/issues/2795 would

If we had the ability to simulate already published packages, we could have a very robust check for packages that are safe to publish in a mono-repo by iteratively running the check and treating publishable packages as published.

natebosch avatar Feb 15 '23 19:02 natebosch